Skip to content

Production code that branches on a value copied from the tests ​

Tests and verification: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as test-logic.

What makes production code that branches on a value from the tests a bad practice? ​

The standards that call it a bad practice: Anthropic system cards: special-casing tests; Meszaros: Test Logic in Production.

What does lessloc do about production code that branches on a value from the tests? ​

lessloc catches it as test-logic.

  • test-logic (tier 1): Production code that checks whether tests are running, says it exists to make tests pass, or branches on a value that appears only in tests.

The other patterns in Tests and verification:

Released under the Apache-2.0 license. · llms.txt