diff options
Diffstat (limited to 'src/test/java/org/shedlang/compiler/parser')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/parser/ParserCallTests.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java b/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java index 5345414f..1020b430 100644 --- a/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java +++ b/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java @@ -81,6 +81,46 @@ public class ParserCallTests { } @Test + public void canParseCallWithSingleNamedArg() { + var source = "f(.first = a)"; + + var node = parseString(source, Parser::parseTopLevelExpression); + + assertThat( + node, + isUntypedCallNode() + .withArgs( + isUntypedArgsNode() + .withPositional(isSequence()) + .withNamed(isSequence( + isUntypedNamedArgNode("first", isUntypedReferenceNode("a")) + )) + ) + ); + } + + @Test + public void canParseCallWithManyNamedArgs() { + var source = "f(.first = a, .second = b, .third = c)"; + + var node = parseString(source, Parser::parseTopLevelExpression); + + assertThat( + node, + isUntypedCallNode() + .withArgs( + isUntypedArgsNode() + .withPositional(isSequence()) + .withNamed(isSequence( + isUntypedNamedArgNode("first", isUntypedReferenceNode("a")), + isUntypedNamedArgNode("second", isUntypedReferenceNode("b")), + isUntypedNamedArgNode("third", isUntypedReferenceNode("c")) + )) + ) + ); + } + + @Test public void argumentListCanHaveTrailingComma() { var source = "f(a,)"; |
