fix(test): fail a run_test line that names no function #88
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/azkaban!88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/harness-missing-test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Every test file registers its tests with
run_test <name>from theshared harness,
tests/harness.sh. A line left behind by a rename, ora misspelled one, named a function that does not exist: the harness
printed the shell's
command not found, thenok, and the suitepassed while the test it meant never ran. This showed during the work
on #86, when a renamed test kept its old
run_testline.What changed
run_testnow fails a name with no function behind it, beforesetupruns: it prints
FAIL: <name>: no such test function, counts the testas failed, and the file exits 1. Before, it printed
okand the fileexited 0.
Tests that exist run as before; a test still fails only by calling
fail.How to verify
The tests need no setup. Base is
f59aef7, branch is99799b7.Write a file with one test that exists and one that does not, from the
repository root:
On the base it prints
test_missing: command not found,ok test_missing,2 test(s), 0 failure(s), andexit=0. On thebranch it prints
FAIL: test_missing: no such test function,2 test(s), 1 failure(s), andexit=1. Run with these results.The regression test:
It passes on the branch, and fails on the base's code at its output
assertion.
make lint && .agents/hooks/shellcheck.sh repo && make testpassed onthe branch: 344 tests, 0 failures, so every
run_testline of thesuite names a function that exists.
Considerations
A test file that registers a missing test now fails where it passed
before; none does today.