Skip to content

Commit

Permalink
shellcheck and use grep instead of diff
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrizhu committed Sep 6, 2024
1 parent 8601a70 commit be0d6aa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/stdstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ sh_stdout=$(mktemp)
sh_stderr=$(mktemp)

# test stdout
echo 5 | "$TRY" "$cmdfile" >$try_stdout 2>$try_stderr
echo 5 | sh "$cmdfile" >$sh_stdout 2>$sh_stderr
echo 5 | "$TRY" "$cmdfile" >"$try_stdout" 2>"$try_stderr"
echo 5 | sh "$cmdfile" >"$sh_stdout" 2>"$sh_stderr"

diff $try_stdout $sh_stdout || exit 1
diff $try_stderr $sh_stderr || exit 1
rm $try_stdout $try_stderr $sh_stdout $sh_stderr
diff "$try_stdout" "$sh_stdout" || exit 1

# using grep because there's try errors printed
grep -q 15 "$try_stderr"
grep -q 15 "$sh_stderr"

rm "$try_stdout" "$try_stderr" "$sh_stdout" "$sh_stderr"

0 comments on commit be0d6aa

Please sign in to comment.