svn commit: r334803 - head/contrib/netbsd-tests/usr.bin/grep

Kyle Evans kevans at FreeBSD.org
Thu Jun 7 18:06:02 UTC 2018


Author: kevans
Date: Thu Jun  7 18:06:01 2018
New Revision: 334803
URL: https://svnweb.freebsd.org/changeset/base/334803

Log:
  netbsd-tests: grep(1): Add test for -c flag
  
  Someone might be inclined to accidentally break this. someone might have
  written said test because they broke it locally.

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==============================================================================
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh	Thu Jun  7 18:01:31 2018	(r334802)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh	Thu Jun  7 18:06:01 2018	(r334803)
@@ -716,6 +716,22 @@ fgrep_oflag_body()
 	atf_check -s exit:1 grep -Fo "ghix" test1
 	atf_check -s exit:1 grep -Fo "abcdefghiklmnopqrstuvwxyz" test1
 }
+
+atf_test_case cflag
+cflag_head()
+{
+	atf_set "descr" "Check proper handling of -c"
+}
+cflag_body()
+{
+	printf "a\nb\nc\n" > test1
+
+	atf_check -o inline:"1\n" grep -Ec "a" test1
+	atf_check -o inline:"2\n" grep -Ec "a|b" test1
+	atf_check -o inline:"3\n" grep -Ec "a|b|c" test1
+
+	atf_check -o inline:"test1:2\n" grep -EHc "a|b" test1
+}
 # End FreeBSD
 
 atf_init_test_cases()
@@ -759,5 +775,6 @@ atf_init_test_cases()
 	atf_add_test_case fgrep_multipattern
 	atf_add_test_case fgrep_icase
 	atf_add_test_case fgrep_oflag
+	atf_add_test_case cflag
 # End FreeBSD
 }


More information about the svn-src-head mailing list