aboutsummaryrefslogtreecommitdiff
path: root/claude-rules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-19 12:36:04 -0500
committerCraig Jennings <c@cjennings.net>2026-04-19 12:36:04 -0500
commit019db5f9677902ba02d703a8554667d1b6e88f6b (patch)
tree37c7991c7e29b443348996f1c2407030b3571026 /claude-rules
parent18fcaf9f27d03849487078b30f667c3b574e6554 (diff)
downloadrulesets-019db5f9677902ba02d703a8554667d1b6e88f6b.tar.gz
rulesets-019db5f9677902ba02d703a8554667d1b6e88f6b.zip
refactor: generalize testing.md, split Python specifics, DRY install
claude-rules/testing.md is now language-agnostic (TDD principles, test categories, coverage targets, anti-patterns). Scope header widened to **/*. Python-specific content (pytest, fixtures, parametrize, anyio, Django DB testing) moved to languages/python/claude/rules/python-testing.md. Added languages/python/ bundle (rules only so far; no CLAUDE.md template or hooks yet — Python validation tooling differs from Elisp). Added install-python shortcut to the Makefile. Updated scripts/install-lang.sh to copy claude-rules/*.md into each target project's .claude/rules/. Bundles no longer need to carry their own verification.md copy — deleted languages/elisp/claude/rules/verification.md. Single source of truth in claude-rules/, fans out via install. Elisp-testing.md now references testing.md as its base (matches the python-testing.md pattern).
Diffstat (limited to 'claude-rules')
-rw-r--r--claude-rules/testing.md21
1 files changed, 17 insertions, 4 deletions
diff --git a/claude-rules/testing.md b/claude-rules/testing.md
index 37ba412..42cc528 100644
--- a/claude-rules/testing.md
+++ b/claude-rules/testing.md
@@ -1,6 +1,10 @@
# Testing Standards
-Applies to: `**/*.py`, `**/*.ts`, `**/*.tsx`, `**/*.js`, `**/*.jsx`
+Applies to: `**/*`
+
+Core TDD discipline and test quality rules. Language-specific patterns
+(frameworks, fixture idioms, mocking tools) live in per-language testing files
+under `languages/<lang>/claude/rules/`.
## Test-Driven Development (Default)
@@ -56,6 +60,8 @@ Every unit under test requires coverage across three categories:
## Test Organization
+Typical layout:
+
```
tests/
unit/ # One test file per source file
@@ -63,14 +69,21 @@ tests/
e2e/ # Full system tests
```
+Per-language files may adjust this (e.g. Elisp collates ERT tests into
+`tests/test-<module>*.el` without subdirectories).
+
## Naming Convention
- Unit: `test_<module>_<function>_<scenario>_<expected>`
- Integration: `test_integration_<workflow>_<scenario>_<outcome>`
Examples:
-- `test_satellite_calculate_position_null_input_raises_error`
-- `test_integration_telemetry_sync_network_timeout_retries_three_times`
+- `test_cart_apply_discount_expired_coupon_raises_error`
+- `test_integration_order_sync_network_timeout_retries_three_times`
+
+Languages that prefer camelCase, kebab-case, or other conventions keep the
+structure but use their idiom. Consistency within a project matters more than
+the specific case choice.
## Test Quality
@@ -100,7 +113,7 @@ Mock external dependencies at the system boundary:
Never mock:
- The code under test
- Internal domain logic
-- Framework behavior (ORM queries, middleware, hooks)
+- Framework behavior (ORM queries, middleware, hooks, buffer primitives)
## Coverage Targets