aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2017-07-23 14:32:27 -0500
committerRob Landley <rob@landley.net>2017-07-23 14:32:27 -0500
commitcd64fbd192ba304ea8b94c5192bd8b613dd96834 (patch)
treef3870bb519a9e8c08bdaace7439335a0549d4c72
parent6e2ef60264d99022ed2a435b09e1fcf4f6bac178 (diff)
downloadtoybox-cd64fbd192ba304ea8b94c5192bd8b613dd96834.tar.gz
Add basic env.test
-rwxr-xr-xtests/env.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/env.test b/tests/env.test
new file mode 100755
index 00000000..e92164c5
--- /dev/null
+++ b/tests/env.test
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+[ -f testing.sh ] && . testing.sh
+
+#testcmd "name "args" "result" "infile" "stdin"
+#testing "name" "command" "result" "infile" "stdin"
+
+export WALRUS=42 BANANA=hello LETTERS=
+FILTER="| egrep '^(WALRUS|BANANA|LETTERS)=' | sort"
+
+testcmd "read" "$FILTER" "BANANA=hello\nLETTERS=\nWALRUS=42\n" "" ""
+testcmd "-u" "-u BANANA $FILTER" "LETTERS=\nWALRUS=42\n" "" ""
+testcmd "-uu" "-u LETTERS -u WALRUS $FILTER" "BANANA=hello\n" "" ""
+testcmd "-i" "-i env" "" "" ""
+testcmd "-i =" "-i one=two three=four env | sort" \
+ "one=two\nthree=four\n" "" ""
+testcmd "-0" "-i five=six seven=eight env -0 | sort -z" "five=six\0seven=eight\0" "" ""
+unset WALRUS BANANA LETTERS FILTER