X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=testsuite%2Fgrep.tests;h=26f8e69cfd44f08a68128a20035306cffa218bea;hb=16bcd504a32e6a7bf2015ffb241133f9ead6100b;hp=74b0eb63f39317796dddc9419cf40af880f7a49c;hpb=3ba2df874ca27f075a0897210d8dce6c56646e60;p=oweals%2Fbusybox.git diff --git a/testsuite/grep.tests b/testsuite/grep.tests index 74b0eb63f..26f8e69cf 100755 --- a/testsuite/grep.tests +++ b/testsuite/grep.tests @@ -15,7 +15,7 @@ testing "grep (exit with error)" "grep nonexistent 2> /dev/null ; echo \$?" \ "1\n" "" "" -testing "grep (exit success)" "grep grep $0 > /dev/null 2>&1 ; echo \$?" "0\n" \ +testing "grep (exit success)" "grep grep '$0' > /dev/null 2>&1 ; echo \$?" "0\n" \ "" "" # Test various data sources and destinations @@ -96,7 +96,7 @@ 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" "" -optional FEATURE_GREP_EGREP_ALIAS +optional EGREP testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \ "b\ar\nfoo\nbaz" testing "grep is also egrep" "egrep foo" "foo\n" "" "foo\nbar\n" @@ -165,6 +165,45 @@ testing "grep -w word doesn't match wordword" \ "wordword\n" \ "" +testing "grep -F -w w doesn't match ww" \ + "grep -F -w w input" \ + "" \ + "ww\n" \ + "" + +testing "grep -w word match second word" \ + "grep -w word input" \ + "bword,word\n""wordb,word\n""bwordb,word\n" \ + "bword,word\n""wordb,word\n""bwordb,word\n" \ + "" + + +testing "grep -x -v -e EXP1 -e EXP2 finds nothing if either EXP matches" \ + "grep -x -v -e '.*aa.*' -e 'bb.*'; echo \$?" \ + "1\n" \ + "" \ + " aa bb cc\n" + +# -r on symlink to dir should recurse into dir +mkdir -p grep.testdir/foo +echo bar > grep.testdir/foo/file +ln -s foo grep.testdir/symfoo +testing "grep -r on symlink to dir" \ + "grep -r . grep.testdir/symfoo" \ + "grep.testdir/symfoo/file:bar\n" \ + "" "" +rm -Rf grep.testdir + +# But -r on dir/symlink_to_dir should not recurse into symlink_to_dir +mkdir -p grep.testdir/foo +echo bar > grep.testdir/foo/file +ln -s foo grep.testdir/symfoo +testing "grep -r on dir/symlink to dir" \ + "grep -r . grep.testdir" \ + "grep.testdir/foo/file:bar\n" \ + "" "" +rm -Rf grep.testdir + # testing "test name" "commands" "expected result" "file input" "stdin" # file input will be file called "input" # test can create a file "actual" instead of writing to stdout