From 286c60bc9d1b692b650bd0c37a6da635e99f119f Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 17 May 2015 14:17:01 -0700 Subject: 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. --- tests/function.in | 14 ++++++++++++++ tests/function.out | 4 ++++ 2 files changed, 18 insertions(+) (limited to 'tests') 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 diff --git a/tests/function.out b/tests/function.out index 3fa70990..5a3da619 100644 --- a/tests/function.out +++ b/tests/function.out @@ -18,3 +18,7 @@ $bar: (5) 4: '' 5: '3' $baz: (0) +Function name1 found +Function name2 found +Function name3 found +Function name4 found -- cgit v1.2.3