diff options
author | Rob Landley <rob@landley.net> | 2019-10-28 23:47:08 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-10-28 23:47:08 -0500 |
commit | 78a4be9e6862b970ac33d5ea3f95c98e658a3557 (patch) | |
tree | 9ba0c4da8456c6dc2237aa7a6859af8d31f2a14d | |
parent | ab3e920602e447ad85e17923095b886e07dd586e (diff) | |
download | toybox-78a4be9e6862b970ac33d5ea3f95c98e658a3557.tar.gz |
Only create test file "input" when input argument isn't empty.
-rw-r--r-- | scripts/runtest.sh | 2 | ||||
-rwxr-xr-x | tests/cmp.test | 2 | ||||
-rwxr-xr-x | tests/grep.test | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/scripts/runtest.sh b/scripts/runtest.sh index 90d6299b..d1ae4408 100644 --- a/scripts/runtest.sh +++ b/scripts/runtest.sh @@ -114,7 +114,7 @@ testing() fi echo -ne "$3" > expected - echo -ne "$4" > input + [ ! -z "$4" ] && echo -ne "$4" > input || rm -f input echo -ne "$5" | ${EVAL:-eval} -- "$2" > actual RETVAL=$? diff --git a/tests/cmp.test b/tests/cmp.test index 0c4355ab..d1a8033b 100755 --- a/tests/cmp.test +++ b/tests/cmp.test @@ -35,7 +35,7 @@ testing "-s diff, return code" "cmp -s input input2 2>&1 || echo yes" "yes\n" "a testing "-l EOF, stderr" "cmp -l input input2 2>&1" "cmp: EOF on input2\n" "ab\nc\nx" "" testing "-l diff and EOF, stdout and stderr" "cmp -l input input2 2>&1 | sort" "4 170 143\ncmp: EOF on input2\n" "ab\nx\nx" "" -testing "-s not exist" "cmp -s input doesnotexist 2>&1 || echo yes" "yes\n" "" "" +testing "-s not exist" "cmp -s input doesnotexist 2>&1 || echo yes" "yes\n" "x" "" rm input2 diff --git a/tests/grep.test b/tests/grep.test index 69f8036e..e3753c2c 100755 --- a/tests/grep.test +++ b/tests/grep.test @@ -120,7 +120,7 @@ testing "-HnbB1" "grep -HnbB1 f input" \ testing "-q match overrides error" \ "grep -q hello missing input 2>/dev/null && echo yes" "yes\n" "hello\n" "" testing "-q not found is 1" \ - 'grep -q hello input || echo $?' "1\n" "" "" + 'grep -q hello input || echo $?' "1\n" "x" "" testing "-q missing is 2" \ 'grep -q hello missing missing 2>/dev/null || echo $?' "2\n" "" "" testing "-q missing survives exists but not found" \ |