aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2017-05-11 12:31:43 -0500
committerRob Landley <rob@landley.net>2017-05-11 12:31:43 -0500
commitaa1a5d2798432fb4230b43b9215be2ca66664db2 (patch)
tree1cda9db6a7d610c42a32a88638e46336d578eb80 /tests
parent0a558836e7c19899b3a719c79d6d472366cb0f30 (diff)
downloadtoybox-aa1a5d2798432fb4230b43b9215be2ca66664db2.tar.gz
Switch to testcmd and add "-e all but \c" test.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/echo.test34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/echo.test b/tests/echo.test
index 90c87eb9..e2035561 100755
--- a/tests/echo.test
+++ b/tests/echo.test
@@ -7,30 +7,30 @@
# To make it work, "$CMD" is an explicit path to the command being tested,
# so "result" keeps using the shell builtin but we test the one in toybox.
-CMD="$(which echo)"
-
#testing "name" "command" "result" "infile" "stdin"
-testing "echo" "$CMD && echo yes" "\nyes\n" "" ""
-testing "1 2 3" "$CMD one two three" "one two three\n" "" ""
-testing "with spaces" "$CMD 'one two three'" \
+testcmd "echo" "&& echo yes" "\nyes\n" "" ""
+testcmd "1 2 3" "one two three" "one two three\n" "" ""
+testcmd "with spaces" "'one two three'" \
"one two three\n" "" ""
-testing "-n" "$CMD -n" "" "" ""
-testing "-n one" "$CMD -n one" "one" "" ""
-testing "one -n" "$CMD one -n" "one -n\n" "" ""
-testing "-en" "$CMD -en 'one\ntwo'" "one\ntwo" "" ""
-testing "--hello" "$CMD --hello" "--hello\n" "" ""
-testing "-e all" "$CMD -e '\a\b\c\f\n\r\t\v\\\0123' | xxd -p" "0708\n" "" ""
-testing "-nex hello" "$CMD -nex hello" "-nex hello\n" "" ""
+testcmd "" "-n" "" "" ""
+testcmd "" "-n one" "one" "" ""
+testcmd "" "one -n" "one -n\n" "" ""
+testcmd "-en" "-en 'one\ntwo'" "one\ntwo" "" ""
+testcmd "" "--hello" "--hello\n" "" ""
+testcmd "-e all" "-e '\a\b\c\f\n\r\t\v\\\0123' | xxd -p" "0708\n" "" ""
+testcmd "-e all but \\c" "-e '"'\a\b\f\n\r\t\v\\\0123'"' | xxd -p" \
+ "07080c0a0d090b5c530a\n" "" ""
+testcmd "-nex hello" "-nex hello" "-nex hello\n" "" ""
# Octal formatting tests
-testing "-e octal values" \
- "$CMD -ne '\01234 \0060 \060 \0130\0131\0132 \077\012'" \
+testcmd "-e octal values" \
+ "-ne '\01234 \0060 \060 \0130\0131\0132 \077\012'" \
"S4 0 0 XYZ ?\n" "" ""
# Hexadecimal value tests
-testing "-e hexadecimal values" \
- "$CMD -ne '\x534 \x30 \x58\x59\x5a \x3F\x0A'"\
+testcmd "-e hexadecimal values" \
+ "-ne '\x534 \x30 \x58\x59\x5a \x3F\x0A'"\
"S4 0 XYZ ?\n" "" ""
-testing "-e \p" "$CMD -e '\\p'" "\\p\n" "" ""
+testcmd "-e \p" "-e '\\p'" "\\p\n" "" ""