Skip to content

Commit

Permalink
grep: add testcase to test color when matches is greater than MAX_MAT…
Browse files Browse the repository at this point in the history
…CHES
  • Loading branch information
vchimishuk committed Oct 7, 2024
1 parent 6058dcd commit d8cdbf3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions contrib/netbsd-tests/usr.bin/grep/d_color_d.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobar
6 changes: 6 additions & 0 deletions contrib/netbsd-tests/usr.bin/grep/t_grep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ color_body()

atf_check -o file:"$(atf_get_srcdir)/d_color_c.out" \
grep --color=always -f grepfile "$(atf_get_srcdir)/d_color_b.in"
# Begin FreeBSD
MAX_MATCHES=32
for _ in $(seq $((MAX_MATCHES + 1))); do printf "foobar"; done > grepfile
atf_check -o file:"$(atf_get_srcdir)/d_color_d.out" \
grep --color=always foo grepfile
# End FreeBSD
}

atf_test_case f_file_empty
Expand Down
1 change: 1 addition & 0 deletions usr.bin/grep/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ${PACKAGE}FILES+= d_color_a.out
${PACKAGE}FILES+= d_color_b.in
${PACKAGE}FILES+= d_color_b.out
${PACKAGE}FILES+= d_color_c.out
${PACKAGE}FILES+= d_color_d.out
${PACKAGE}FILES+= d_context2_a.out
${PACKAGE}FILES+= d_context2_b.out
${PACKAGE}FILES+= d_context2_c.out
Expand Down

0 comments on commit d8cdbf3

Please sign in to comment.