summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2017-01-10 19:14:26 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2017-01-10 19:14:26 +0000
commitbb218704d27bcca9aa4426296dcd5c13d58b330a (patch)
treea9644ce52924e524a0e443869585f5286f7261a7 /Test
parentb088b67a54872a33ea78ef25ee312c8f31e88c71 (diff)
downloadzsh-bb218704d27bcca9aa4426296dcd5c13d58b330a.tar.gz
zsh-bb218704d27bcca9aa4426296dcd5c13d58b330a.tar.xz
zsh-bb218704d27bcca9aa4426296dcd5c13d58b330a.zip
40306 with doc tweaks: Change behaviour expanding alias in () function definition.
Now an error unless the () is part of the same error as the name.
Add ALIAS_FUNC_DEF option to allow it again.
Diffstat (limited to 'Test')
-rw-r--r--Test/A02alias.ztst22
1 files changed, 22 insertions, 0 deletions
diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst
index e52578ec3..e68e93e0d 100644
--- a/Test/A02alias.ztst
+++ b/Test/A02alias.ztst
@@ -82,6 +82,7 @@
 0:Global aliasing quotes
 > a string S 
 *>*5*echo S a string S "
+# "
 # Note there is a trailing space on the "> a string S " line
 
   (
@@ -115,3 +116,24 @@
 1:error message has the correct sign
 ?(eval):alias:1: bad option: +x
 ?(eval):alias:1: bad option: -z
+
+  # Usual issue that aliases aren't expanded until we
+  # trigger a new parse...
+  (alias badalias=notacommand
+  eval 'badalias() { print does not work; }')
+1:ALIAS_FUNC_DEF off by default.
+?(eval):1: defining function based on alias `badalias'
+?(eval):1: parse error near `()'
+
+  (alias goodalias=isafunc
+  setopt ALIAS_FUNC_DEF
+  eval 'goodalias() { print does now work; }'
+  isafunc)
+0:ALIAS_FUNC_DEF causes the icky behaviour to be avaliable
+>does now work
+
+  (alias thisisokthough='thisworks() { print That worked; }'
+  eval thisisokthough
+  thisworks)
+0:NO_ALIAS_FUNC_DEF works if the alias is a complete definition
+>That worked