From: Nick Bowler Date: Sat, 8 Jul 2023 17:33:29 +0000 (-0400) Subject: tests: Fix interactive test without libreadline. X-Git-Tag: v1.3~122 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/c5810975e3ec971fc8caf65f58b77c96c97b2571 tests: Fix interactive test without libreadline. When using actual readline, the user's input is echoed internally, so the test case sees the actual input commands in the captured standard output. But in the getline-based fallback, the input is not reflected to the output. This is expected behaviour, but confuses the test case. Rewrite the check to accept either form. --- diff --git a/tests/general.at b/tests/general.at index b0806a3..498028e 100644 --- a/tests/general.at +++ b/tests/general.at @@ -158,7 +158,13 @@ quit ]]) AT_CHECK([cdecl99 --quiet --interactive /d' stdout], [0], [declare x as int + +# If built with readline support, then the input commands (including their +# trailing newlines) will be captured by AT_CHECK. Otherwise, they are not: +# the output just directly follows the prompt, and the final prompt will +# not end with a newline. Attempt to paper over these differences. +AT_CHECK([echo >>stdout; sed '/> [[eq]]/d; s/^> //; /^$/d' stdout], [0], +[declare x as int ]) AT_CLEANUP