From 6119e528886cb97b78f210d99420d680445740d2 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 14 Jan 2022 07:39:42 +0000 Subject: [PATCH] Clean up after each test and test stderr --- test.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/test.sh b/test.sh index 4e647d5..06408d2 100755 --- a/test.sh +++ b/test.sh @@ -11,6 +11,7 @@ EOF echo "line 2" > test.expect echo "$INPUT" | ./skip 1 > test.out diff --brief test.expect test.out +rm test.expect test.out echo "> skip a line when reading from a file" cat< test.in @@ -20,6 +21,7 @@ EOF echo "line 2" > test.expect ./skip 1 test.in > test.out diff --brief test.expect test.out +rm test.expect test.out echo "> skip until 2 matching lines seen" cat< test.in @@ -37,6 +39,7 @@ alpha EOF ./skip 2 test.in --line alpha > test.out diff --brief test.expect test.out +rm test.in test.expect test.out echo "> skip lines until 2 tokens seen" cat< test.in @@ -55,15 +58,22 @@ quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. EOF -./skip 2 test.in --token dolor > test.out +./skip 2 test.in --token dolor > test.out 2 diff --brief test.expect test.out +rm test.in test.expect test.out echo "> handle unknown parameter with simple error message" -cat< test.expect +cat< test.expect.err Invalid argument '--foo' EOF -./skip --foo > test.out 2>&1 || ## error is expected +cat< test.expect +EOF +touch test.out test.err +./skip --foo > test.out 2> test.err diff --brief test.expect test.out +diff --brief test.expect.err test.err +rm test.expect test.out +rm test.expect.err test.err echo "> skip lines until 3 tokens seen - ignored extra tokens on same line" cat< test.in @@ -83,7 +93,6 @@ commodo consequat. EOF ./skip 3 test.in --token m --ignore-extras > test.out diff --brief test.expect test.out - -rm test.in test.out test.expect +rm test.in test.expect test.out echo done