From 7c91b65f5406aaf4d7e351ad7c12b85913aa99a1 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Tue, 6 Jun 2017 21:50:00 +0000 Subject: [PATCH] Add testcases for `cat -b` MFC after: 1 month Sponsored by: Dell EMC Isilon --- bin/cat/tests/Makefile | 2 ++ contrib/netbsd-tests/bin/cat/d_b_output.in | 4 ++++ contrib/netbsd-tests/bin/cat/d_b_output.out | 4 ++++ contrib/netbsd-tests/bin/cat/t_cat.sh | 16 ++++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 contrib/netbsd-tests/bin/cat/d_b_output.in create mode 100644 contrib/netbsd-tests/bin/cat/d_b_output.out diff --git a/bin/cat/tests/Makefile b/bin/cat/tests/Makefile index d7a7468fdbe6..92e16aea1732 100644 --- a/bin/cat/tests/Makefile +++ b/bin/cat/tests/Makefile @@ -6,6 +6,8 @@ NETBSD_ATF_TESTS_SH= cat_test ${PACKAGE}FILES+= d_align.in ${PACKAGE}FILES+= d_align.out +${PACKAGE}FILES+= d_b_output.in +${PACKAGE}FILES+= d_b_output.out ${PACKAGE}FILES+= d_se_output.in ${PACKAGE}FILES+= d_se_output.out ${PACKAGE}FILES+= d_s_output.in diff --git a/contrib/netbsd-tests/bin/cat/d_b_output.in b/contrib/netbsd-tests/bin/cat/d_b_output.in new file mode 100644 index 000000000000..921e95485240 --- /dev/null +++ b/contrib/netbsd-tests/bin/cat/d_b_output.in @@ -0,0 +1,4 @@ +This is a line + +The line before this was a blank line. + This line has leading whitespace. diff --git a/contrib/netbsd-tests/bin/cat/d_b_output.out b/contrib/netbsd-tests/bin/cat/d_b_output.out new file mode 100644 index 000000000000..fef6d8f73d86 --- /dev/null +++ b/contrib/netbsd-tests/bin/cat/d_b_output.out @@ -0,0 +1,4 @@ + 1 This is a line + + 2 The line before this was a blank line. + 3 This line has leading whitespace. diff --git a/contrib/netbsd-tests/bin/cat/t_cat.sh b/contrib/netbsd-tests/bin/cat/t_cat.sh index 9ee053e026e7..10706372f87d 100755 --- a/contrib/netbsd-tests/bin/cat/t_cat.sh +++ b/contrib/netbsd-tests/bin/cat/t_cat.sh @@ -52,6 +52,19 @@ nonexistent_body() { -x "cat /some/name/that/does/not/exist" } +# Begin FreeBSD +atf_test_case b_output +b_output_head() { + atf_set "descr" "Test that cat(1) prints out numbers on non-blank "\ + "lines with '-b'" +} + +b_output_body() { + atf_check -o file:$(atf_get_srcdir)/d_b_output.out \ + cat -b $(atf_get_srcdir)/d_b_output.in +} +# End FreeBSD + atf_test_case se_output se_output_head() { atf_set "descr" "Test that cat(1) prints a $ sign " \ @@ -103,6 +116,9 @@ atf_init_test_cases() { atf_add_test_case align atf_add_test_case nonexistent +# Begin FreeBSD + atf_add_test_case b_output +# End FreeBSD atf_add_test_case se_output # Begin FreeBSD atf_add_test_case s_output