diff options
author | ngie <ngie@FreeBSD.org> | 2017-07-06 05:22:02 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-07-06 05:22:02 +0000 |
commit | 1741e09ff7858c5659afce22ebef585020d0124c (patch) | |
tree | 507f8fe52864c11e45eef5ebaf2f804427711748 | |
parent | e074b0bb218152d07d1c32c12f6016796df4f004 (diff) | |
download | FreeBSD-src-1741e09ff7858c5659afce22ebef585020d0124c.zip FreeBSD-src-1741e09ff7858c5659afce22ebef585020d0124c.tar.gz |
MFC r319634:
Add additional testcases for cat(1)
Verify the following additional cases:
- -s (in isolation, in addition to the -se testcase obtained via the
NetBSD test).
- -vt
-rw-r--r-- | bin/cat/tests/Makefile | 4 | ||||
-rw-r--r-- | contrib/netbsd-tests/bin/cat/d_s_output.in | 6 | ||||
-rw-r--r-- | contrib/netbsd-tests/bin/cat/d_s_output.out | 5 | ||||
-rw-r--r-- | contrib/netbsd-tests/bin/cat/d_vt_output.in | 3 | ||||
-rw-r--r-- | contrib/netbsd-tests/bin/cat/d_vt_output.out | 3 | ||||
-rwxr-xr-x | contrib/netbsd-tests/bin/cat/t_cat.sh | 41 |
6 files changed, 62 insertions, 0 deletions
diff --git a/bin/cat/tests/Makefile b/bin/cat/tests/Makefile index 92e3582..d7a7468 100644 --- a/bin/cat/tests/Makefile +++ b/bin/cat/tests/Makefile @@ -8,6 +8,10 @@ ${PACKAGE}FILES+= d_align.in ${PACKAGE}FILES+= d_align.out ${PACKAGE}FILES+= d_se_output.in ${PACKAGE}FILES+= d_se_output.out +${PACKAGE}FILES+= d_s_output.in +${PACKAGE}FILES+= d_s_output.out +${PACKAGE}FILES+= d_vt_output.in +${PACKAGE}FILES+= d_vt_output.out .include <netbsd-tests.test.mk> diff --git a/contrib/netbsd-tests/bin/cat/d_s_output.in b/contrib/netbsd-tests/bin/cat/d_s_output.in new file mode 100644 index 0000000..44f91aa --- /dev/null +++ b/contrib/netbsd-tests/bin/cat/d_s_output.in @@ -0,0 +1,6 @@ +a b c + + +1 2 3 + +x y z diff --git a/contrib/netbsd-tests/bin/cat/d_s_output.out b/contrib/netbsd-tests/bin/cat/d_s_output.out new file mode 100644 index 0000000..37d30c7 --- /dev/null +++ b/contrib/netbsd-tests/bin/cat/d_s_output.out @@ -0,0 +1,5 @@ +a b c + +1 2 3 + +x y z diff --git a/contrib/netbsd-tests/bin/cat/d_vt_output.in b/contrib/netbsd-tests/bin/cat/d_vt_output.in new file mode 100644 index 0000000..0a74b4d --- /dev/null +++ b/contrib/netbsd-tests/bin/cat/d_vt_output.in @@ -0,0 +1,3 @@ + +<BS> +á diff --git a/contrib/netbsd-tests/bin/cat/d_vt_output.out b/contrib/netbsd-tests/bin/cat/d_vt_output.out new file mode 100644 index 0000000..e98cea9 --- /dev/null +++ b/contrib/netbsd-tests/bin/cat/d_vt_output.out @@ -0,0 +1,3 @@ +^I +^X<BS> +M-a diff --git a/contrib/netbsd-tests/bin/cat/t_cat.sh b/contrib/netbsd-tests/bin/cat/t_cat.sh index 799a748..9ee053e 100755 --- a/contrib/netbsd-tests/bin/cat/t_cat.sh +++ b/contrib/netbsd-tests/bin/cat/t_cat.sh @@ -63,9 +63,50 @@ se_output_body() { -x "cat -se $(atf_get_srcdir)/d_se_output.in" } +# Begin FreeBSD +atf_test_case s_output +s_output_head() { + atf_set "descr" "Test that cat(1) squeezes multiple adjacent " \ + "empty lines producing a single spaced output with option '-s'" +} + +s_output_body() { + atf_check -s ignore -o file:$(atf_get_srcdir)/d_s_output.out \ + cat -s $(atf_get_srcdir)/d_s_output.in +} + +atf_test_case e_output +e_output_head() { + atf_set "descr" "Test that cat(1) prints a $ sign " \ + "on blank lines with option '-e'" +} + +e_output_body() { + atf_check -s ignore -o file:$(atf_get_srcdir)/d_se_output.out \ + cat -e $(atf_get_srcdir)/d_se_output.in +} + +atf_test_case vt_output +vt_output_head() { + atf_set "descr" "Test that cat(1) displays non-printing characters, " \ + "namely control characters, tab character and meta-characters " \ + "using options '-vt'" +} + +vt_output_body() { + atf_check -s ignore -o file:$(atf_get_srcdir)/d_vt_output.out \ + cat -vt $(atf_get_srcdir)/d_vt_output.in +} +# End FreeBSD + atf_init_test_cases() { atf_add_test_case align atf_add_test_case nonexistent atf_add_test_case se_output +# Begin FreeBSD + atf_add_test_case s_output + atf_add_test_case e_output + atf_add_test_case vt_output +# End FreeBSD } |