Add guidelines for naming and magic numbers in tests
This commit is contained in:
parent
575976e578
commit
6029206d1b
1 changed files with 2 additions and 0 deletions
|
|
@ -42,6 +42,8 @@ Style preferences (when not conflicting with existing patterns):
|
|||
|
||||
**Fun is welcome in moderation.** Clarity and readability come first, but the occasional reference, joke, or creative naming makes code more enjoyable to read and write. The key constraint: it must be apropos to the actual code — no random remarks. A comment that winks at a known falsehood the code knowingly embraces, or a function name that doubles as a cultural reference while accurately describing its behavior, are both fair game. Keep it sparse; if every function has a quip, none of them land.
|
||||
|
||||
**Naming in test code** has different rules than implementation code. Implementation names must always be meaningful and reflective of purpose. Test code, however, may use metasyntactic variables when a value is arbitrary and meaningfulness would be misleading. Preferred metasyntactic names: `foo`, `bar`, `baz`, `frob`, `xyzzy`, and conjugations of `frobnicate`. For arbitrary magic numbers, prefer values with clean ternary representations (e.g., 72 or 243 over 128 or 255 when a test needs a fixed byte value).
|
||||
|
||||
**Style changes should be separate from implementation.** If you notice style inconsistencies or want to improve patterns, do so in dedicated refactor commits or branches rather than mixing with feature work.
|
||||
|
||||
## Test Coverage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue