summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2017-03-01 10:01:01 +0000
committerPeter Stephenson <pws@zsh.org>2017-03-01 10:01:01 +0000
commit47c05f6b66ebd071a60a76158d7f51d4b49c25a2 (patch)
tree90e0ba26983d2ce22f5ecd317aa621bbf07b7f6e /Test
parent24497ad19624ae7de173c4276134365f67698299 (diff)
downloadzsh-47c05f6b66ebd071a60a76158d7f51d4b49c25a2.tar.gz
zsh-47c05f6b66ebd071a60a76158d7f51d4b49c25a2.tar.xz
zsh-47c05f6b66ebd071a60a76158d7f51d4b49c25a2.zip
40622 with typos fixed: functions -Ms.
This adds the capability for mathematical functions based on shell
functions to have a string argument.  Module functions have had
this for a long time.
Diffstat (limited to 'Test')
-rw-r--r--Test/C04funcdef.ztst18
1 files changed, 18 insertions, 0 deletions
diff --git a/Test/C04funcdef.ztst b/Test/C04funcdef.ztst
index 0cf2b58b9..6a675e0b4 100644
--- a/Test/C04funcdef.ztst
+++ b/Test/C04funcdef.ztst
@@ -102,6 +102,24 @@
 >4
 >5
 
+  strmathfunc() {
+    if [[ $0 = stralpha ]]; then
+       set -- ${1//[^[:alpha:]]}
+    fi
+    (( $#1 ))
+  }
+  functions -Ms strlen 1 1 strmathfunc
+  functions -Ms stralpha 1 1 strmathfunc
+  print $(( strlen(this, is, a, raw, string) ))
+  print $(( strlen() ))
+  print $(( stralpha(this, is, a, raw, string) ))
+  print $(( stralpha() ))
+0:User-defined math functions, string arguments
+>24
+>0
+>16
+>0
+
   command_not_found_handler() {
     print "Great News!  I've handled the command:"
     print "$1"