diff --git a/src/signature.js b/src/signature.js index d0eb4e41..69066d49 100644 --- a/src/signature.js +++ b/src/signature.js @@ -248,11 +248,20 @@ const signature = (() => { }; } } else { - validatedArgs.push(arg); - argIndex++; + //validatedArgs.push(arg); + //argIndex++; + validatedArgs.push(undefined); } + } else if (match.length > 1 && param.type !== 'a') { // may have matched multiple args (if the regex ends with a '+') + //the signature should have been like 'n+' - we still pack multiple args into array + var argsAsArray = []; + match.split('').forEach(function () { + arg = args[argIndex]; + argsAsArray.push(arg); + argIndex++; + }); + validatedArgs.push(argsAsArray); } else { - // may have matched multiple args (if the regex ends with a '+') // split into single tokens match.split('').forEach(function (single) { arg = args[argIndex]; diff --git a/test/test-suite/groups/function-signatures/case035.json b/test/test-suite/groups/function-signatures/case035.json index d2a1a5c8..c0a03b74 100644 --- a/test/test-suite/groups/function-signatures/case035.json +++ b/test/test-suite/groups/function-signatures/case035.json @@ -3,7 +3,7 @@ "dataset": null, "bindings": {}, "result": { - "$arg1": 1, - "$arg2": 2 + "$arg1": [1, 2], + "$arg2": 3 } } \ No newline at end of file diff --git a/test/test-suite/groups/function-signatures/case040.json b/test/test-suite/groups/function-signatures/case040.json index 25199bd4..208d9e6f 100644 --- a/test/test-suite/groups/function-signatures/case040.json +++ b/test/test-suite/groups/function-signatures/case040.json @@ -2,5 +2,5 @@ "expr": "λ($arg1, $arg2)>{[$arg1, $arg2]}(1, 2, 3)", "dataset": null, "bindings": {}, - "result": [1, 2] + "result": [1, 2, 3] } \ No newline at end of file diff --git a/test/test-suite/groups/function-signatures/case041.json b/test/test-suite/groups/function-signatures/case041.json new file mode 100644 index 00000000..119dc92e --- /dev/null +++ b/test/test-suite/groups/function-signatures/case041.json @@ -0,0 +1,6 @@ +{ + "expr": "λ($arg1, $arg2){{\"arg1\": $arg1, \"arg2\": $arg2}}(1, 2, 3)", + "dataset": null, + "bindings": {}, + "result": {"arg2": [1, 2, 3]} +} \ No newline at end of file diff --git a/test/test-suite/groups/function-signatures/case042.json b/test/test-suite/groups/function-signatures/case042.json new file mode 100644 index 00000000..3577fc41 --- /dev/null +++ b/test/test-suite/groups/function-signatures/case042.json @@ -0,0 +1,6 @@ +{ + "expr": "λ($arg1, $arg2)>{[$arg1, $arg2]}(\"1\", 2, 3)", + "dataset": null, + "bindings": {}, + "result": ["1", 2, 3] +} \ No newline at end of file diff --git a/test/test-suite/groups/function-signatures/case043.json b/test/test-suite/groups/function-signatures/case043.json new file mode 100644 index 00000000..4c55d42f --- /dev/null +++ b/test/test-suite/groups/function-signatures/case043.json @@ -0,0 +1,9 @@ +{ + "expr": "λ($arg1, $arg2){{\"arg1\": $arg1, \"arg2\": $arg2}}(\"1\", 2, 3)", + "dataset": null, + "bindings": {}, + "result": { + "arg1": "1", + "arg2": [2, 3] + } +} \ No newline at end of file diff --git a/test/test-suite/groups/function-signatures/case044.json b/test/test-suite/groups/function-signatures/case044.json new file mode 100644 index 00000000..3259763c --- /dev/null +++ b/test/test-suite/groups/function-signatures/case044.json @@ -0,0 +1,6 @@ +{ + "expr": "λ($arg1, $arg2){{\"arg1\": $arg1, \"arg2\": $arg2}}(2)", + "dataset": null, + "bindings": {}, + "result": {"arg2": 2} +} \ No newline at end of file