# Mock cargo-style test run. Reads files instead of compiling, so tools/test-tools.sh can # drive tools/mutation-table.sh locally. b_write rewrites a TRACKED file and, on a bad # stamp, creates an UNTRACKED one; a_read fails if either leaks into a later run. e_cache # keeps state in an IGNORED file (cache.txt, see .gitignore), like a cache under target/. p=0; f=0 t() { if "$2"; then echo "test $1 ... ok"; p=$((p + 1)); else echo "test $1 ... FAILED"; f=$((f + 1)); fi; } a_read() { [ "$(cat data.txt)" = ok ] && [ ! -e leak.tmp ]; } b_write() { cat stamp.txt >data.txt; [ "$(cat stamp.txt)" = ok ] || { touch leak.tmp; return 1; }; } c_add() { [ "$(cat add.txt)" = 5 ]; } d_win() { [ "$(tr -d '\r' cache.txt; [ "$(cat stamp.txt)" = ok ]; } t tests::a_read a_read; t tests::b_write b_write; t tests::c_add c_add; t tests::d_win d_win; t tests::e_cache e_cache echo "test result: $([ $f = 0 ] && echo ok || echo FAILED). $p passed; $f failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s" [ $f = 0 ]