aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-02-26 13:43:33 -0600
committerRob Landley <rob@landley.net>2020-02-26 13:43:33 -0600
commit5e7b83c5661dc882c96cd3c616afc144ee22f13d (patch)
treefa04d9ada2b3aa43f6af59270dfa1367e049c6f6
parentef30ea278b5cee37782008ff9369720acd1a7337 (diff)
downloadtoybox-5e7b83c5661dc882c96cd3c616afc144ee22f13d.tar.gz
More sh tests.
-rwxr-xr-xtests/sh.test8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/sh.test b/tests/sh.test
index cf9d755d..6a121ce2 100755
--- a/tests/sh.test
+++ b/tests/sh.test
@@ -11,8 +11,10 @@
[ -z "$SH" ] && { [ -z "$TEST_HOST" ] && SH="sh" || export SH="bash" ; }
# Test the sh -c stuff before changing EVAL
-testing '$SH -c "" exit status 0' 'sh -c "" && echo $?' '0\n' '' ''
-testing '$SH -c arg split' \
+testing '-c "" exit status 0' '$SH -c "" && echo $?' '0\n' '' ''
+testing '-c args' "\$SH -c 'echo \$0,\$1,\$2,\$3' one two three four five" \
+ "one,two,three,four\n" "" ""
+testing '-c arg split' \
"$SH -c 'for i in a\"\$@\"b;do echo =\$i=;done;echo \$0' 123 456 789" \
"=a456=\n=789b=\n123\n" "" ""
testing "exec3" '$C -c "{ exec readlink /proc/self/fd/0;} < /proc/self/exe"' \
@@ -56,6 +58,7 @@ testing "redir4" "touch /not/exist 2>out||grep -o /not/exist out" \
"/not/exist\n" "" ""
testing "redir5" "ls out /not/exist &> out2 || wc -l < out2" "2\n" "" ""
testing "redir6" "ls out /not/exist |& wc -l" "2\n" "" ""
+testing "redir7" 'echo -n $(<input)' "boing" "boing\n" ""
testing "tilde expansion" "echo ~" "$HOME\n" "" ""
testing "tilde2" "echo ~/dir" "$HOME/dir\n" "" ""
@@ -76,6 +79,7 @@ testing "bracket+tilde" "echo {~,~root}/pwd" "$HOME/pwd $EXPECT/pwd\n" "" ""
#testing "backtick1" 'X=fred; echo `echo $x`' 'fred\n' "" ""
#testing "backtick2" 'X=fred; echo `x=y; echo $x`' 'y\n' "" ""
+testing '$(( ) )' 'echo $((echo hello) | tr e x)' "hxllo\n" "" ""
testing "leading variable assignment" 'abc=def env | grep ^abc=; echo $abc' \
"abc=def\n\n" "" ""