Index: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh =================================================================== --- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh +++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh @@ -687,6 +687,59 @@ atf_check -s exit:1 grep "" test1 } + +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 + 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() +{ + 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 atf_init_test_cases() @@ -728,5 +781,8 @@ atf_add_test_case mmap atf_add_test_case mmap_eof_not_eol 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 }