summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenys Vlasenko2020-08-15 00:39:30 +0200
committerDenys Vlasenko2020-08-15 00:39:30 +0200
commita77f3ecf68c63081934f5e0800eab80b5098bb24 (patch)
treeb8d9b333378f24b92feb2c38ea1552e465dca96d /testsuite
parent5c69ad0ecdc18cf51b312c7c82848f4438fe1c8d (diff)
downloadbusybox-a77f3ecf68c63081934f5e0800eab80b5098bb24.zip
busybox-a77f3ecf68c63081934f5e0800eab80b5098bb24.tar.gz
grep: for -L, exitcode 0 means files *without* matches were found, closes 13151
This is a recent change in GNU grep as well (after 3.1) function old new delta grep_file 1215 1228 +13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/grep.tests8
1 files changed, 8 insertions, 0 deletions
diff --git a/testsuite/grep.tests b/testsuite/grep.tests
index e382788..66498a9 100755
--- a/testsuite/grep.tests
+++ b/testsuite/grep.tests
@@ -96,6 +96,14 @@ testing "grep -x -F (partial match 1)" "grep -x -F foo input ; echo \$?" \
testing "grep -x -F (partial match 2)" "grep -x -F foo input ; echo \$?" \
"1\n" "bar foo\n" ""
+# -L "show filenames which do not match" has inverted exitcode (if it printed something, it's "success")
+testing "grep -L exitcode 0" "grep -L qwe input; echo \$?" \
+ "input\n0\n" "asd\n" ""
+testing "grep -L exitcode 0 #2" "grep -L qwe input -; echo \$?" \
+ "(standard input)\n0\n" "qwe\n" "asd\n"
+testing "grep -L exitcode 1" "grep -L qwe input; echo \$?" \
+ "1\n" "qwe\n" ""
+
optional EGREP
testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \
"b\ar\nfoo\nbaz"