OhMyBug

tests/ci

Self Derived Expected Value

#67uncommon54 sightingsfirst seen August 2026

What goes wrong

The expected value in the assertion is produced by the same function, constant, or format as the actual value. If that code changes, both sides change together, so the test proves only that the code agrees with itself, not that it meets the contract.

Example

The test compares the price formatter's output with the price formatter's output for the same price, so a broken formatter still passes.

Not to be confused with

The expected value follows the implementation; test data where two alternatives happen to be equal is Primary And Fallback Equal In Test, an independent literal that correctly fails after a deliberate change is Test Still Expects The Old Value, and a production check comparing a config to itself is Guard Compares Config To Itself.

Discovered by

Field notes · 20