Changeset View
Changeset View
Standalone View
Standalone View
contrib/netbsd-tests/usr.bin/grep/t_grep.sh
Show First 20 Lines • Show All 681 Lines • ▼ Show 20 Lines | matchall_body() | ||||
printf "A\nB" > test3 | printf "A\nB" > test3 | ||||
atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test1 test2 test3 | atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test1 test2 test3 | ||||
atf_check -o inline:"test3:A\ntest3:B\ntest2:A\n" grep "" test3 test1 test2 | atf_check -o inline:"test3:A\ntest3:B\ntest2:A\n" grep "" test3 test1 test2 | ||||
atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test2 test3 test1 | atf_check -o inline:"test2:A\ntest3:A\ntest3:B\n" grep "" test2 test3 test1 | ||||
atf_check -s exit:1 grep "" test1 | atf_check -s exit:1 grep "" test1 | ||||
} | } | ||||
ngie: Aren't some testcases missing dealing with newline separated patterns?
``` -F, --fixed… | |||||
Not Done Inline ActionsNegative; that's not an fgrep specific feature, that's just how grep in general interprets PATTERN. This is reflected better in bsdgrep(1), where this isn't specifically mentioned in -F. Breaking up the pattern by newlines happens long before it gets to the bit that I care to test the most, and should happen elsewhere. kevans: Negative; that's not an `fgrep` specific feature, that's just how `grep` in general interprets… | |||||
atf_test_case fgrep_multipattern | |||||
fgrep_multipattern_head() | |||||
{ | |||||
atf_set "descr" "Check proper behavior with multiple patterns supplied to fgrep" | |||||
} | |||||
fgrep_multipattern_body() | |||||
{ | |||||
printf "Foo\nBar\nBaz" > test1 | |||||
atf_check -o inline:"Foo\nBaz\n" grep -F -e "Foo" -e "Baz" test1 | |||||
atf_check -o inline:"Foo\nBaz\n" grep -F -e "Baz" -e "Foo" test1 | |||||
atf_check -o inline:"Bar\nBaz\n" grep -F -e "Bar" -e "Baz" test1 | |||||
} | |||||
atf_test_case fgrep_icase | |||||
fgrep_icase_head() | |||||
{ | |||||
atf_set "descr" "Check proper handling of -i supplied to fgrep" | |||||
} | |||||
fgrep_icase_body() | |||||
{ | |||||
printf "Foo\nBar\nBaz" > test1 | |||||
atf_check -o inline:"Foo\nBaz\n" grep -Fi -e "foo" -e "baz" test1 | |||||
atf_check -o inline:"Foo\nBaz\n" grep -Fi -e "baz" -e "foo" test1 | |||||
atf_check -o inline:"Bar\nBaz\n" grep -Fi -e "bar" -e "baz" test1 | |||||
Done Inline ActionsProbably worth adding a test for something like -e "BAR" -e "bAz" emaste: Probably worth adding a test for something like `-e "BAR" -e "bAz"` | |||||
Not Done Inline ActionsRight- actual mixed-case stuff makes sense =p. kevans: Right- actual mixed-case stuff makes sense =p. | |||||
atf_check -o inline:"Bar\nBaz\n" grep -Fi -e "BAR" -e "bAz" test1 | |||||
} | |||||
atf_test_case fgrep_oflag | |||||
fgrep_oflag_head() | |||||
{ | |||||
atf_set "descr" "Check proper handling of -o supplied to fgrep" | |||||
} | |||||
fgrep_oflag_body() | |||||
{ | |||||
Not Done Inline Actionsany reason 'h' is missing, just out of curiosity? emaste: any reason 'h' is missing, just out of curiosity? | |||||
Not Done Inline ActionsKeyboard goofs- 'h' takes extra effort on my Pinebook's keyboard. When I was typing this out, I failed to put in that extra effort and then just carried on with the typo. kevans: Keyboard goofs- 'h' takes extra effort on my Pinebook's keyboard. When I was typing this out, I… | |||||
Not Done Inline Actions:) emaste: :) | |||||
printf "abcdefghi\n" > test1 | |||||
atf_check -o inline:"a\n" grep -Fo "a" test1 | |||||
atf_check -o inline:"i\n" grep -Fo "i" test1 | |||||
atf_check -o inline:"abc\n" grep -Fo "abc" test1 | |||||
atf_check -o inline:"fgh\n" grep -Fo "fgh" test1 | |||||
atf_check -o inline:"cde\n" grep -Fo "cde" test1 | |||||
atf_check -o inline:"bcd\n" grep -Fo -e "bcd" -e "cde" test1 | |||||
atf_check -o inline:"bcd\nefg\n" grep -Fo -e "bcd" -e "efg" test1 | |||||
atf_check -s exit:1 grep -Fo "xabc" test1 | |||||
atf_check -s exit:1 grep -Fo "abcx" test1 | |||||
atf_check -s exit:1 grep -Fo "xghi" test1 | |||||
atf_check -s exit:1 grep -Fo "ghix" test1 | |||||
atf_check -s exit:1 grep -Fo "abcdefghiklmnopqrstuvwxyz" test1 | |||||
} | |||||
# End FreeBSD | # End FreeBSD | ||||
atf_init_test_cases() | atf_init_test_cases() | ||||
{ | { | ||||
atf_add_test_case basic | atf_add_test_case basic | ||||
atf_add_test_case binary | atf_add_test_case binary | ||||
atf_add_test_case recurse | atf_add_test_case recurse | ||||
atf_add_test_case recurse_symlink | atf_add_test_case recurse_symlink | ||||
Show All 25 Lines | # Begin FreeBSD | ||||
atf_add_test_case grep_sanity | atf_add_test_case grep_sanity | ||||
atf_add_test_case ocolor_metadata | atf_add_test_case ocolor_metadata | ||||
atf_add_test_case grep_nomatch_flags | atf_add_test_case grep_nomatch_flags | ||||
atf_add_test_case binary_flags | atf_add_test_case binary_flags | ||||
atf_add_test_case badcontext | atf_add_test_case badcontext | ||||
atf_add_test_case mmap | atf_add_test_case mmap | ||||
atf_add_test_case mmap_eof_not_eol | atf_add_test_case mmap_eof_not_eol | ||||
atf_add_test_case matchall | atf_add_test_case matchall | ||||
atf_add_test_case fgrep_multipattern | |||||
atf_add_test_case fgrep_icase | |||||
atf_add_test_case fgrep_oflag | |||||
# End FreeBSD | # End FreeBSD | ||||
} | } |
Aren't some testcases missing dealing with newline separated patterns?