aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2019-09-03 18:32:29 +0000
committerKyle Evans <kevans@FreeBSD.org>2019-09-03 18:32:29 +0000
commitaef64c62c2a6a059e175b3a8b57a61aa4f3f2db8 (patch)
tree3ec56128076b74a3393bde6526d9b0723dbb6cb6 /usr.bin
parentbb3c7a5440062fda70085eab2a7a62654b4dde14 (diff)
downloadsrc-aef64c62c2a6a059e175b3a8b57a61aa4f3f2db8.tar.gz
src-aef64c62c2a6a059e175b3a8b57a61aa4f3f2db8.zip
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.
Notes
Notes: svn path=/head/; revision=351769
Diffstat (limited to 'usr.bin')
-rwxr-xr-xusr.bin/grep/tests/grep_freebsd_test.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/usr.bin/grep/tests/grep_freebsd_test.sh b/usr.bin/grep/tests/grep_freebsd_test.sh
index 2268c05a555f..6d5566a43a03 100755
--- a/usr.bin/grep/tests/grep_freebsd_test.sh
+++ b/usr.bin/grep/tests/grep_freebsd_test.sh
@@ -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
}