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

Submitted by:	shivansh
Reviewed by:	asomers (earlier diff), ngie
MFC after:	1 month
Sponsored by:	Google, Inc (GSoC 2017)
Differential Revision:	D11020
This commit is contained in:
Enji Cooper 2017-06-06 21:03:43 +00:00
parent 761097c85e
commit 9086e0e068
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=319634
6 changed files with 62 additions and 0 deletions

View file

@ -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>

View file

@ -0,0 +1,6 @@
a b c
1 2 3
x y z

View file

@ -0,0 +1,5 @@
a b c
1 2 3
x y z

View file

@ -0,0 +1,3 @@
<BS>
<EFBFBD>

View file

@ -0,0 +1,3 @@
^I
^X<BS>
M-a

View file

@ -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
}