aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-07-26 15:42:02 -0700
committerRob Landley <rob@landley.net>2018-08-04 11:11:00 -0500
commite9dfdd76d5b4ca9d875136f085acd9001c5bfdce (patch)
treed270dbbf8137bad5b8c0a262387216e28990d839
parent65c743f97a738fd3a6f97a0b759bb8a4da964c58 (diff)
downloadtoybox-e9dfdd76d5b4ca9d875136f085acd9001c5bfdce.tar.gz
Add tests for grep with implicit/explicit BREs and explicit EREs.
This is in POSIX, but pcre2grep gets it wrong (https://bugs.exim.org/show_bug.cgi?id=2294).
-rwxr-xr-xtests/grep.test8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/grep.test b/tests/grep.test
index 2a4f178b..21cd8bbb 100755
--- a/tests/grep.test
+++ b/tests/grep.test
@@ -143,3 +143,11 @@ rm test
# match after NUL byte
testing "match after NUL byte" "grep -a two" "one\0and two three\n" \
"" 'one\0and two three'
+
+# BREs versus EREs
+testing "implicit BRE |" "grep 'uno|dos'" "uno|dos\n" \
+ "" "uno\ndos\nuno|dos\n"
+testing "explicit BRE |" "grep -e 'uno|dos'" "uno|dos\n" \
+ "" "uno\ndos\nuno|dos\n"
+testing "explicit ERE |" "grep -E 'uno|dos'" "uno\ndos\nuno|dos\n" \
+ "" "uno\ndos\nuno|dos\n"