bin/cat: add test for reading data from stdin

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1671
Closes: https://github.com/freebsd/freebsd-src/pull/1671
This commit is contained in:
K Rin
2025-04-20 17:59:34 +08:00
committed by Warner Losh
parent 83f7e20c25
commit 65cda8a11d
3 changed files with 17 additions and 0 deletions
+1
View File
@@ -12,6 +12,7 @@ ${PACKAGE}FILES+= d_s_output.in
${PACKAGE}FILES+= d_s_output.out
${PACKAGE}FILES+= d_vt_output.in
${PACKAGE}FILES+= d_vt_output.out
${PACKAGE}FILES+= stdin_test.out
.include <netbsd-tests.test.mk>
@@ -0,0 +1 @@
This is nothing but a cat test.
+15
View File
@@ -112,6 +112,20 @@ vt_output_body() {
}
# End FreeBSD
# Begin FreeBSD
atf_test_case stdin_test
stdin_test_head() {
atf_set "descr" "Test that cat(1) receives data from stdin " \
"and outputs."
}
stdin_test_body() {
echo "This is nothing but a cat test." | \
atf_check -s ignore -o file:$(atf_get_srcdir)/stdin_test.out \
cat
}
# End FreeBSD
atf_init_test_cases()
{
atf_add_test_case align
@@ -124,5 +138,6 @@ atf_init_test_cases()
atf_add_test_case s_output
atf_add_test_case e_output
atf_add_test_case vt_output
atf_add_test_case stdin_test
# End FreeBSD
}