aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-test2
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush_test/hush-test2')
-rw-r--r--shell/hush_test/hush-test2/andor1.right6
-rwxr-xr-xshell/hush_test/hush-test2/andor1.tests7
-rw-r--r--shell/hush_test/hush-test2/noglob1.right2
-rwxr-xr-xshell/hush_test/hush-test2/noglob1.tests3
-rw-r--r--shell/hush_test/hush-test2/strops1.right8
-rwxr-xr-xshell/hush_test/hush-test2/strops1.tests15
-rw-r--r--shell/hush_test/hush-test2/strops2.right6
-rwxr-xr-xshell/hush_test/hush-test2/strops2.tests12
-rw-r--r--shell/hush_test/hush-test2/strops3.right7
-rwxr-xr-xshell/hush_test/hush-test2/strops3.tests13
10 files changed, 79 insertions, 0 deletions
diff --git a/shell/hush_test/hush-test2/andor1.right b/shell/hush_test/hush-test2/andor1.right
new file mode 100644
index 000000000..038c7a681
--- /dev/null
+++ b/shell/hush_test/hush-test2/andor1.right
@@ -0,0 +1,6 @@
+1:YES
+2:no
+3:YES
+4:YES
+5:no
+6:no
diff --git a/shell/hush_test/hush-test2/andor1.tests b/shell/hush_test/hush-test2/andor1.tests
new file mode 100755
index 000000000..c449de7e6
--- /dev/null
+++ b/shell/hush_test/hush-test2/andor1.tests
@@ -0,0 +1,7 @@
+e=''
+[[ a && b ]] && echo 1:YES
+[[ a && '' ]] || echo 2:no
+[[ a || b ]] && echo 3:YES
+[[ '' || b ]] && echo 4:YES
+[[ "" || "$e" ]] || echo 5:no
+[[ "" || $e ]] || echo 6:no
diff --git a/shell/hush_test/hush-test2/noglob1.right b/shell/hush_test/hush-test2/noglob1.right
new file mode 100644
index 000000000..d0c3f1d8e
--- /dev/null
+++ b/shell/hush_test/hush-test2/noglob1.right
@@ -0,0 +1,2 @@
+1:YES:0
+2:YES:0
diff --git a/shell/hush_test/hush-test2/noglob1.tests b/shell/hush_test/hush-test2/noglob1.tests
new file mode 100755
index 000000000..963bacbd3
--- /dev/null
+++ b/shell/hush_test/hush-test2/noglob1.tests
@@ -0,0 +1,3 @@
+v='*.tests'
+[[ *.tests ]]; echo 1:YES:$?
+[[ $v ]]; echo 2:YES:$?
diff --git a/shell/hush_test/hush-test2/strops1.right b/shell/hush_test/hush-test2/strops1.right
new file mode 100644
index 000000000..590496301
--- /dev/null
+++ b/shell/hush_test/hush-test2/strops1.right
@@ -0,0 +1,8 @@
+1:YES:0
+2:YES:0
+3:YES:0
+4:YES:0
+5:YES:0
+6:YES:0
+7:YES:0
+8:no:1
diff --git a/shell/hush_test/hush-test2/strops1.tests b/shell/hush_test/hush-test2/strops1.tests
new file mode 100755
index 000000000..bb24e2a2f
--- /dev/null
+++ b/shell/hush_test/hush-test2/strops1.tests
@@ -0,0 +1,15 @@
+v='*.z'
+[[ a.z = *.z ]]; echo 1:YES:$?
+[[ a.z == $v ]]; echo 2:YES:$?
+
+# wildcards can match a slash
+[[ a/b = a*b ]]; echo 3:YES:$?
+[[ a/b == a?b ]]; echo 4:YES:$?
+
+# wildcards can match a leading dot
+[[ a/.b = a/*b ]]; echo 5:YES:$?
+[[ a/.b == a/?b ]]; echo 6:YES:$?
+
+# wildcards can be escaped
+[[ abc = a*c ]]; echo 7:YES:$?
+[[ abc == a\*c ]]; echo 8:no:$?
diff --git a/shell/hush_test/hush-test2/strops2.right b/shell/hush_test/hush-test2/strops2.right
new file mode 100644
index 000000000..8ddb4b0f0
--- /dev/null
+++ b/shell/hush_test/hush-test2/strops2.right
@@ -0,0 +1,6 @@
+1:ERR2:2
+2:YES:0
+3:YES:0
+4:YES:0
+5:no:1
+6:YES:0
diff --git a/shell/hush_test/hush-test2/strops2.tests b/shell/hush_test/hush-test2/strops2.tests
new file mode 100755
index 000000000..ab325bc9f
--- /dev/null
+++ b/shell/hush_test/hush-test2/strops2.tests
@@ -0,0 +1,12 @@
+# malformed regex
+[[ a =~ * ]]; echo 1:ERR2:$?
+
+[[ a/b =~ a.b ]]; echo 2:YES:$?
+[[ a/b =~ /*b ]]; echo 3:YES:$?
+
+v='[]b.-]'
+[[ a/.b] =~ $v ]]; echo 4:YES:$?
+
+v=']b.-'
+[[ a/.b] =~ $v ]]; echo 5:no:$?
+[[ a/.b] =~ [$v] ]]; echo 6:YES:$?
diff --git a/shell/hush_test/hush-test2/strops3.right b/shell/hush_test/hush-test2/strops3.right
new file mode 100644
index 000000000..14cc04fdc
--- /dev/null
+++ b/shell/hush_test/hush-test2/strops3.right
@@ -0,0 +1,7 @@
+1:YES:0
+2:YES:0
+3:no:1
+4:YES:0
+2u:YES:0
+3u:YES:0
+4u:YES:0
diff --git a/shell/hush_test/hush-test2/strops3.tests b/shell/hush_test/hush-test2/strops3.tests
new file mode 100755
index 000000000..927476671
--- /dev/null
+++ b/shell/hush_test/hush-test2/strops3.tests
@@ -0,0 +1,13 @@
+# regex should accept '+' operator
+[[ abcdef =~ a[b-z]+ ]]; echo 1:YES:$?
+
+# newline matches by "match any" patterns
+v='
+'
+[[ "$v" =~ . ]]; echo 2:YES:$?
+[[ "$v" =~ "[$v]" ]]; echo 3:no:$? # hmm bash does return 1... why?
+[[ "$v" =~ [^a] ]]; echo 4:YES:$?
+# should work even without quotes:
+[[ $v =~ . ]]; echo 2u:YES:$?
+[[ $v =~ [$v] ]]; echo 3u:YES:$?
+[[ $v =~ [^a] ]]; echo 4u:YES:$?