summaryrefslogtreecommitdiff
path: root/tests/sh.testcases
diff options
context:
space:
mode:
authorMark Whitley2001-05-24 17:15:33 +0000
committerMark Whitley2001-05-24 17:15:33 +0000
commit04052f96e1385405787356f0955afadd73d8f029 (patch)
tree1a95bdf6e1e21bb031b872d032ba2ca0d0664757 /tests/sh.testcases
parenta813afc24f864e0055bdd0ef8cde6777a514b212 (diff)
downloadbusybox-04052f96e1385405787356f0955afadd73d8f029.zip
busybox-04052f96e1385405787356f0955afadd73d8f029.tar.gz
Numerous new testcases from Larry Doolittle and a patch to tester.sh to avoid
a bash2-ism and quote variables that contain strings.
Diffstat (limited to 'tests/sh.testcases')
-rw-r--r--tests/sh.testcases33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/sh.testcases b/tests/sh.testcases
new file mode 100644
index 0000000..85d72a2
--- /dev/null
+++ b/tests/sh.testcases
@@ -0,0 +1,33 @@
+# try running this with bash, ksh, ash, and hush.
+echo `echo -e foo\\\necho bar`
+
+echo THIS IS A TEST >foo
+cat $(echo FOO | tr 'A-Z' 'a-z')
+cat foo | tr 'A-Z' 'a-z'
+cat $(echo FOO | tr 'A-Z' 'a-z') | tr 'A-Z' 'a-z'
+
+cat foo | if true; then tr 'A-Z' 'a-z'; else echo bar1; fi
+cat foo | if false; then tr 'A-Z' 'a-z'; else echo bar2; fi
+if true; then tr 'A-Z' 'a-z'; else echo bar3; fi <foo
+if false; then tr 'A-Z' 'a-z'; else echo bar4; fi <foo
+if true || false; then echo foo; else echo bar5; fi
+if true && false; then echo bar6; else echo foo; fi
+
+# ash, lash, and hush do not create fish; bash and ksh do. Tough.
+# Thanks to Tapani Tarvainen <tt@mit.jyu.fi> for this stress test.
+unset TMP
+rm -f fish
+TMP=fish >$TMP
+ls fish
+
+# The following example shows that hush's parser is
+# not _really_ Bourne compatible
+echo "echo Hello World" >"a=b"
+unset a
+chmod a+x "a=b"
+PATH=$PATH:.
+"a=b"
+echo $a
+
+# assuming the shell wasn't too buggy, clean up the mess
+rm -f a=b fish foo