aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/function.in
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-05-17 14:17:01 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-05-17 14:17:01 -0700
commit286c60bc9d1b692b650bd0c37a6da635e99f119f (patch)
tree0afbe223a384e7562e94b306a91d1f89ae724330 /tests/function.in
parentc26d317da5950645590fecf45c907f35ba0462bb (diff)
Correctly handle mixing named arguments with function name
Before this fix, `function -a arg1 name1` would produce a function named 'arg1'. After this fix, it will produce a function named 'name'. See #2068 for more.
Diffstat (limited to 'tests/function.in')
-rw-r--r--tests/function.in14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/function.in b/tests/function.in
index e533b25b..747bbcec 100644
--- a/tests/function.in
+++ b/tests/function.in
@@ -30,3 +30,17 @@ set foo 'bad foo'
set bar 'bad bar'
set baz 'bad baz'
frob
+
+# Test that -a does not mix up the function name with arguments
+# See #2068
+function name1 -a arg1 arg2 ; end
+function -a arg1 arg2 name2 ; end
+function name3 --argument-names arg1 arg2 ; end
+function --argument-names arg1 arg2 name4 ; end
+for i in (seq 4)
+ if functions -q name$i
+ echo "Function name$i found"
+ else
+ echo "Function name$i not found, but should have been"
+ end
+end