commit: 2e2049e0fb0c4bd500f084e5e4dccf76e77e291d
parent 9e39a1ab738a31ba424ef53cd943ec063b46d4c3
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 6 Nov 2021 18:56:36 +0100
test-bin/xcd: Add tests based on /dev/null
Diffstat:
4 files changed, 54 insertions(+), 14 deletions(-)
diff --git a/test-bin/cat b/test-bin/cat
@@ -1,22 +1,40 @@
#!/usr/bin/env atf-sh
-atf_test_case openfile
-openfile_body() {
- atf_check -o file:inputs/all_bytes ../bin/cat inputs/all_bytes
+atf_test_case allfile
+allfile_body() {
+ atf_check -o file:inputs/cat/all_bytes ../bin/cat inputs/cat/all_bytes
}
-atf_test_case stdinput
-stdinput_body() {
- atf_check -o file:inputs/all_bytes ../bin/cat <inputs/all_bytes
+atf_test_case allinput
+allinput_body() {
+ atf_check -o file:inputs/cat/all_bytes ../bin/cat <inputs/cat/all_bytes
}
-atf_test_case devnull
-devnull_body() {
+atf_test_case alldashinput
+alldashinput_body() {
+ atf_check -o file:inputs/cat/all_bytes ../bin/cat - <inputs/cat/all_bytes
+}
+
+atf_test_case nullfile
+nullfile_body() {
atf_check ../bin/cat /dev/null
}
+atf_test_case nullinput
+nullinput_body() {
+ atf_check ../bin/cat </dev/null
+}
+
+atf_test_case nulldashinput
+nulldashinput_body() {
+ atf_check ../bin/cat - </dev/null
+}
+
atf_init_test_cases() {
cd "$(atf_get_srcdir)"
- atf_add_test_case openfile
- atf_add_test_case stdinput
- atf_add_test_case devnull
+ atf_add_test_case allfile
+ atf_add_test_case allinput
+ atf_add_test_case alldashinput
+ atf_add_test_case nullfile
+ atf_add_test_case nullinput
+ atf_add_test_case nulldashinput
}
diff --git a/test-bin/outputs/xcd/null b/test-bin/outputs/xcd/null
@@ -0,0 +1,3 @@
+[0m[48;2;0;0;0m[38;2;64;64;64m000000 [0m[48;2;0;0;0m[0m[48;2;0;0;0m >[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[38;2;64;64;64m.[0m[48;2;0;0;0m<
+[38;2;64;64;64m000000
+[0m[48;2;0;0;0m[0m
+\ No newline at end of file
diff --git a/test-bin/tee b/test-bin/tee
@@ -1,6 +1,6 @@
#!/usr/bin/env atf-sh
-atf_test_case noargs
-noargs_body() {
+atf_test_case allinput
+allinput_body() {
atf_check -o file:inputs/all_bytes ../bin/tee <inputs/all_bytes
}
@@ -24,9 +24,15 @@ appendfile_cleanup() {
rm tmp_tee.log
}
+atf_test_case nullinput
+nullinput_body() {
+ atf_check ../bin/tee </dev/null
+}
+
atf_init_test_cases() {
cd "$(atf_get_srcdir)"
- atf_add_test_case noargs
+ atf_add_test_case allinput
atf_add_test_case writefile
atf_add_test_case appendfile
+ atf_add_test_case nullinput
}
diff --git a/test-bin/xcd b/test-bin/xcd
@@ -9,8 +9,20 @@ stdinput_body() {
atf_check -o file:outputs/xcd/all_bytes ../bin/xcd <inputs/all_bytes
}
+atf_test_case nullfile
+nullfile_body() {
+ atf_check -o file:outputs/xcd/null ../bin/xcd /dev/null
+}
+
+atf_test_case nullinput
+nullinput_body() {
+ atf_check -o file:outputs/xcd/null ../bin/xcd </dev/null
+}
+
atf_init_test_cases() {
cd "$(atf_get_srcdir)"
atf_add_test_case openfile
atf_add_test_case stdinput
+ atf_add_test_case nullfile
+ atf_add_test_case nullinput
}