]> git.draconx.ca Git - cdecl99.git/commitdiff
tests: Fix interactive test without libreadline.
authorNick Bowler <nbowler@draconx.ca>
Sat, 8 Jul 2023 17:33:29 +0000 (13:33 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sat, 8 Jul 2023 17:44:40 +0000 (13:44 -0400)
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.

tests/general.at

index b0806a3fb4e39284bfd8e57f31c688cb31c6241f..498028e4c4b6e6d2cd3d3ada53778b16682a7184 100644 (file)
@@ -158,7 +158,13 @@ quit
 ]])
 
 AT_CHECK([cdecl99 --quiet --interactive <test.dat], [0], [stdout])
-AT_CHECK([sed '/^>/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