diff options
Diffstat (limited to 'tests/read.sh')
-rwxr-xr-x | tests/read.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/read.sh b/tests/read.sh index d7be18fdcecb..4881c10db58c 100755 --- a/tests/read.sh +++ b/tests/read.sh @@ -74,6 +74,7 @@ results="$testdir/$d/read_results.txt" errors="$testdir/$d/read_errors.txt" out="$outputdir/${d}_outputs/read_results.txt" +multiple_res="$outputdir/${d}_outputs/read_multiple_results.txt" outdir=$(dirname "$out") # Make sure the directory exists. @@ -89,11 +90,13 @@ if [ "$d" = "bc" ]; then halt="halt" read_call="read()" read_expr="${read_call}\n5+5;" + read_multiple=$(printf '%s\n%s\n%s\n' "3" "2" "1") else options="-x" halt="q" read_call="?" read_expr="${read_call}" + read_multiple=$(printf '%spR\n%spR\n%spR\n' "3" "2" "1") fi # I use these, so unset them to make the tests work. @@ -116,6 +119,16 @@ done < "$name" printf 'pass\n' +printf 'Running %s read multiple...' "$d" + +printf '3\n2\n1\n' > "$multiple_res" + +# Run multiple read() calls. +printf '%s\n' "$read_multiple" | "$exe" "$@" "$options" -e "$read_call" -e "$read_call" -e "$read_call" > "$out" +checktest "$d" "$?" 'read multiple' "$multiple_res" "$out" + +printf 'pass\n' + printf 'Running %s read errors...' "$d" # Run read on every line. |