bsdgrep(1): add some basic tests for some GNU Extension support

These will be expanded later as I come up with good test cases; for now,
these seem to be enough to trigger bugs in base gnugrep and expose missing
features in bsdgrep.
This commit is contained in:
Kyle Evans 2019-09-03 18:32:29 +00:00
parent bb3c7a5440
commit aef64c62c2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351769

View file

@ -82,8 +82,34 @@ rgrep_body()
atf_check -o file:d_grep_r_implied.out rgrep --exclude="*.out" -e "test" "$(atf_get_srcdir)"
}
atf_test_case gnuext
gnuext_body()
{
grep_type
_type=$?
if [ $_type -eq $GREP_TYPE_BSD ]; then
atf_expect_fail "this test requires GNU extensions in regex(3)"
elif [ $_type -eq $GREP_TYPE_GNU_FREEBSD ]; then
atf_expect_fail "\\s and \\S are known to be buggy in base gnugrep"
fi
atf_check -o save:grep_alnum.out grep -o '[[:alnum:]]' /COPYRIGHT
atf_check -o file:grep_alnum.out grep -o '\w' /COPYRIGHT
atf_check -o save:grep_nalnum.out grep -o '[^[:alnum:]]' /COPYRIGHT
atf_check -o file:grep_nalnum.out grep -o '\W' /COPYRIGHT
atf_check -o save:grep_space.out grep -o '[[:space:]]' /COPYRIGHT
atf_check -o file:grep_space.out grep -o '\s' /COPYRIGHT
atf_check -o save:grep_nspace.out grep -o '[^[:space:]]' /COPYRIGHT
atf_check -o file:grep_nspace.out grep -o '\S' /COPYRIGHT
}
atf_init_test_cases()
{
atf_add_test_case grep_r_implied
atf_add_test_case rgrep
atf_add_test_case gnuext
}