Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/testsuite/grep.tests
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/testsuite/grep.tests
r1765 r2725 1 1 #!/bin/sh 2 2 3 # grep tests.4 3 # Copyright 2005 by Rob Landley <rob@landley.net> 5 # Licensed under GPL v2, see file LICENSE for details.4 # Licensed under GPLv2, see file LICENSE in this source tree. 6 5 7 6 # AUDIT: 8 7 9 . testing.sh8 . ./testing.sh 10 9 11 10 # testing "test name" "options" "expected result" "file input" "stdin" … … 28 27 "one\ntwo\nthree\nthree\nthree\n" "" 29 28 30 testing "grep (no newline at EOL)" "grep bug" "bug" "bug" "" 29 # GNU grep 2.5.3 outputs a new line character after the located string 30 # even if there is no new line character in the input 31 testing "grep (no newline at EOL)" "grep bug input" "bug\n" "bug" "" 31 32 32 # Note that this assumes actual is empty. 33 testing "grep input actual (two files)" "grep two input actual 2>/dev/null" \33 >empty 34 testing "grep two files" "grep two input empty 2>/dev/null" \ 34 35 "input:two\n" "one\ntwo\nthree\nthree\nthree\n" "" 36 rm empty 35 37 36 38 testing "grep - infile (specify stdin and file)" "grep two - input" \ … … 61 63 "(standard input):domatch\n2\n" "" "nomatch\ndomatch\nend\n" 62 64 63 # This doesn't match GNU behaviour (Binary file input matches) 64 # acts like GNU grep -a 65 testing "grep handles binary files" "grep foo input" "foo\n" "\0foo\n\n" "" 66 # This doesn't match GNU behaviour (Binary file (standard input) matches) 67 # acts like GNU grep -a 68 testing "grep handles binary stdin" "grep foo" "foo\n" "" "\0foo\n\n" 65 optional EXTRA_COMPAT 66 testing "grep handles NUL in files" "grep -a foo input" "\0foo\n" "\0foo\n\n" "" 67 testing "grep handles NUL on stdin" "grep -a foo" "\0foo\n" "" "\0foo\n\n" 69 68 70 69 testing "grep matches NUL" "grep . input > /dev/null 2>&1 ; echo \$?" \ 71 70 "0\n" "\0\n" "" 71 SKIP= 72 72 73 73 # -e regex 74 74 testing "grep handles multiple regexps" "grep -e one -e two input ; echo \$?" \ 75 75 "one\ntwo\n0\n" "one\ntwo\n" "" 76 testing "grep -F handles multiple expessions" "grep -F -e one -e two input ; echo \$?" \ 77 "one\ntwo\n0\n" "one\ntwo\n" "" 78 testing "grep -F handles -i" "grep -F -i foo input ; echo \$?" \ 79 "FOO\n0\n" "FOO\n" "" 80 81 # -f file/- 82 testing "grep can read regexps from stdin" "grep -f - input ; echo \$?" \ 83 "two\nthree\n0\n" "tw\ntwo\nthree\n" "tw.\nthr\n" 76 84 77 85 optional FEATURE_GREP_EGREP_ALIAS … … 81 89 testing "egrep is not case insensitive" \ 82 90 "egrep foo ; [ \$? -ne 0 ] && echo yes" "yes\n" "" "FOO\n" 91 testing "grep -E -o prints all matches" \ 92 "grep -E -o '([[:xdigit:]]{2}[:-]){5}[[:xdigit:]]{2}'" \ 93 "00:19:3E:00:AA:5E\n00:1D:60:3D:3A:FB\n00:22:43:49:FB:AA\n" \ 94 "" "00:19:3E:00:AA:5E 00:1D:60:3D:3A:FB 00:22:43:49:FB:AA\n" 95 SKIP= 96 97 testing "grep -o does not loop forever" \ 98 'grep -o "[^/]*$"' \ 99 "test\n" \ 100 "" "/var/test\n" 101 testing "grep -o does not loop forever on zero-length match" \ 102 'grep -o "" | head -n1' \ 103 "" \ 104 "" "test\n" 83 105 84 106 exit $FAILCOUNT
Note:
See TracChangeset
for help on using the changeset viewer.