run: drop the no-newline marker; the check layer now adds a missing final newline itself.
commit edb5960c60f1156d9799e05af939592891582944 · parent dd9793a266
· browse this tree
Ximianth, 2026-10-24 15:45:09 UTC
The runner only makes sure an `exit status: N` line starts on a line of its own.
diff --git a/lib/testmark/run.bash b/lib/testmark/run.bash index 39be5af..aa5b406 100644 --- a/lib/testmark/run.bash +++ b/lib/testmark/run.bash @@ -131,8 +131,10 @@ _testmarktest_case() { _testmarktest_exec "$1" "$2" "$3" printf '\0%s' "$?" ) - [[ -z $stream || $stream == *$'\n' ]] || stream+=$'\n\\ No newline at end of output\n' - ((st == 0)) || stream+="exit status: $st"$'\n' + if ((st != 0)); then + [[ -z $stream || $stream == *$'\n' ]] || stream+=$'\n' + stream+="exit status: $st"$'\n' + fi _testmark_check "$1" "$out" < <(printf '%s' "$stream") } diff --git a/tests/test-run.sh b/tests/test-run.sh index 5d9f38e..94dc63c 100755 --- a/tests/test-run.sh +++ b/tests/test-run.sh @@ -79,7 +79,7 @@ testmarktest_run doc.md' "PASS doc.md: a/in (exercise_fail) --- status 0" -run_case "no final newline gets a marker" "$(one $'x\n\\ No newline at end of output\n')" ' +run_case "a missing final newline is added" "$(one $'x\n')" ' exercise_x() { printf x; } testmarktest_rule_basic "*/in" exercise_x testmarktest_run doc.md' "PASS doc.md: a/in (exercise_x) @@ -87,7 +87,7 @@ testmarktest_run doc.md' "PASS doc.md: a/in (exercise_x) --- status 0" -run_case "the marker, then the exit status" "$(one $'x\n\\ No newline at end of output\nexit status: 1\n')" ' +run_case "the exit status goes on its own line" "$(one $'x\nexit status: 1\n')" ' exercise_x() { printf x; false; } testmarktest_rule_basic "*/in" exercise_x testmarktest_run doc.md' "PASS doc.md: a/in (exercise_x) @@ -103,13 +103,13 @@ testmarktest_run doc.md' "PASS doc.md: a/in (exercise_quiet) --- status 0" -run_case "CRLF fails the case" "$(one '')" ' +run_case "CRLF reads as LF" "$(one $'a\n')" ' exercise_crlf() { printf "a\r\n"; } testmarktest_rule_basic "*/in" exercise_crlf -testmarktest_run doc.md' "FAIL doc.md: a/in (exercise_crlf) +testmarktest_run doc.md' "PASS doc.md: a/in (exercise_crlf) --- stderr -testmark: testmarktest_run: hunk \"a/output\": output must be empty or end in a newline, and contain no CRLF; normalize it before checking ---- status 1" + +--- status 0" run_case "a NUL byte fails the case" "$(one '')" ' exercise_nul() { printf "a\0b\n"; }