summaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-misc
diff options
context:
space:
mode:
authorDenis Vlasenko2009-04-10 12:03:20 +0000
committerDenis Vlasenko2009-04-10 12:03:20 +0000
commit1fd1ea4395e520694bd9f8b1dc9e60af6442946d (patch)
treeffe931a1e9254789ac119321f88b17767176c73c /shell/hush_test/hush-misc
parent551bdfecb7cfb4df0f127d34884e0a9502324acd (diff)
downloadbusybox-1fd1ea4395e520694bd9f8b1dc9e60af6442946d.zip
busybox-1fd1ea4395e520694bd9f8b1dc9e60af6442946d.tar.gz
hush: tighten up "for" variable name check.
Add TODOs. Disable redir4.right part where we differ from bash. It is not a bug per standards. Add a few tests, one is in hush-bugs section: and_or_and_backgrounding.right. It will likely bite users in real world usage.
Diffstat (limited to 'shell/hush_test/hush-misc')
-rw-r--r--shell/hush_test/hush-misc/for_with_bslashes.right8
-rwxr-xr-xshell/hush_test/hush-misc/for_with_bslashes.tests10
-rwxr-xr-xshell/hush_test/hush-misc/redir1.tests2
-rw-r--r--shell/hush_test/hush-misc/redir4.right11
-rwxr-xr-xshell/hush_test/hush-misc/redir4.tests7
5 files changed, 27 insertions, 11 deletions
diff --git a/shell/hush_test/hush-misc/for_with_bslashes.right b/shell/hush_test/hush-misc/for_with_bslashes.right
new file mode 100644
index 0000000..02d9669
--- /dev/null
+++ b/shell/hush_test/hush-misc/for_with_bslashes.right
@@ -0,0 +1,8 @@
+a
+b\c
+b\\c
+b"c
+b'c
+b$c
+b`true`c
+Zero:0
diff --git a/shell/hush_test/hush-misc/for_with_bslashes.tests b/shell/hush_test/hush-misc/for_with_bslashes.tests
new file mode 100755
index 0000000..363f3d8
--- /dev/null
+++ b/shell/hush_test/hush-misc/for_with_bslashes.tests
@@ -0,0 +1,10 @@
+# UNFIXED BUG.
+# commented-out words contain ^C character.
+# It's a SPECIAL_VAR_SYMBOL, for now hush does not escape it.
+# When it is fixed, update this test.
+
+for a in 'a' 'b\c' 'b\\c' 'b"c' "b'c" 'b$c' 'b`true`c' ### 'b#c'
+do
+ echo $a
+done
+echo Zero:$?
diff --git a/shell/hush_test/hush-misc/redir1.tests b/shell/hush_test/hush-misc/redir1.tests
index 70e9e17..ef2fbfb 100755
--- a/shell/hush_test/hush-misc/redir1.tests
+++ b/shell/hush_test/hush-misc/redir1.tests
@@ -27,7 +27,7 @@ var=ok
{ var=bad >shell_test_$$; } &
# cant use usleep as it isnt standard in $PATH --
# we fail when testing busybox compiled solely as "hush"
-sleep 1
+wait
echo "Test 4: var:$var"
test -f shell_test_$$ && echo "File created:ok"
diff --git a/shell/hush_test/hush-misc/redir4.right b/shell/hush_test/hush-misc/redir4.right
index ada6c2d..ead25f6 100644
--- a/shell/hush_test/hush-misc/redir4.right
+++ b/shell/hush_test/hush-misc/redir4.right
@@ -10,16 +10,9 @@ Here3
Ok3
Here4
Ok4
-How with variable refs
+Now with variable refs
shell_test_1
\shell_test_1
\shell_test_1
\shell_test_1
-Here1
-Ok1
-Here2
-Ok2
-Here3
-Ok3
-Here4
-Ok4
+Done
diff --git a/shell/hush_test/hush-misc/redir4.tests b/shell/hush_test/hush-misc/redir4.tests
index ac2a441..c50b8ce 100755
--- a/shell/hush_test/hush-misc/redir4.tests
+++ b/shell/hush_test/hush-misc/redir4.tests
@@ -38,7 +38,7 @@ Here4
echo Ok4
-echo How with variable refs
+echo Now with variable refs
i=1
@@ -58,6 +58,11 @@ rm *shell_test*
echo *shell_test*
rm *shell_test*
+echo Done;exit
+# UNFIXED BUG. bash apparently will expand $i even in terminating delimiter.
+# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
+# does not mandate this behavior.
+# This is not likely to be used much in real-world.
cat <<\shell_test_$i
Here1