summaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-glob
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush_test/hush-glob')
-rw-r--r--shell/hush_test/hush-glob/glob2.right18
-rwxr-xr-xshell/hush_test/hush-glob/glob2.tests27
2 files changed, 45 insertions, 0 deletions
diff --git a/shell/hush_test/hush-glob/glob2.right b/shell/hush_test/hush-glob/glob2.right
new file mode 100644
index 0000000..7a70c22
--- /dev/null
+++ b/shell/hush_test/hush-glob/glob2.right
@@ -0,0 +1,18 @@
+Expected Actual
+Z\* : Z\*
+Z* : Z*
+Z\f : Z\f
+Z\* : Z\*
+
+Z\z : Z\z
+Zz : Zz
+Z\z : Z\z
+Z\z : Z\z
+
+Z\ : Z\
+Z\ : Z\
+
+Z\f Zf : Z\f Zf
+Z\f Zf : Z\f Zf
+
+Done: 0
diff --git a/shell/hush_test/hush-glob/glob2.tests b/shell/hush_test/hush-glob/glob2.tests
new file mode 100755
index 0000000..4dbc925
--- /dev/null
+++ b/shell/hush_test/hush-glob/glob2.tests
@@ -0,0 +1,27 @@
+# This test demonstrates that in unquoted $v, backslashes expand by this rule:
+# \z -> \\\z; \<eol> -> \\<eol> (for any z, special or not),
+# and subsequently globbing converts \\ to \ and treats \z as literal z
+# even if it is a special char.
+
+>'Zf'
+>'Z\f'
+ echo 'Expected' 'Actual'
+v='\*'; echo 'Z\* :' Z$v
+ echo 'Z* :' Z\*
+ echo 'Z\f :' Z\\*
+ echo 'Z\* :' Z\\\* # NB! only this matches Z$v output
+echo
+v='\z'; echo 'Z\z :' Z$v
+ echo 'Zz :' Z\z
+ echo 'Z\z :' Z\\z
+ echo 'Z\z :' Z\\\z
+echo
+v='\'; echo 'Z\ :' Z$v
+ echo 'Z\ :' Z\\
+echo
+v='*'; echo 'Z\f Zf :' Z$v
+ echo 'Z\f Zf :' Z*
+echo
+
+rm 'Z\f' 'Zf'
+echo Done: $?