From 9d66911592c3e3f34aaafdd09c7dd9d96e720e18 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 6 Jun 2023 19:42:44 +0100 Subject: Parse call with no effects and no args --- .../shedlang/compiler/parser/ParserCallTests.java | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/test/java/org/shedlang/compiler/parser/ParserCallTests.java (limited to 'src/test/java/org/shedlang/compiler/parser') diff --git a/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java b/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java new file mode 100644 index 00000000..a5c41cba --- /dev/null +++ b/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java @@ -0,0 +1,29 @@ +package org.shedlang.compiler.parser; + +import org.junit.jupiter.api.Test; + +import static org.shedlang.compiler.ast.UntypedNodeMatchers.*; +import static org.shedlang.compiler.parser.ParserTesting.parseString; +import static org.zwobble.precisely.AssertThat.assertThat; +import static org.zwobble.precisely.Matchers.isSequence; + +public class ParserCallTests { + @Test + public void canParseCallWithoutEffectsWithNoArguments() { + var source = "f()"; + + var node = parseString(source, Parser::parseTopLevelExpression); + + assertThat( + node, + isUntypedCallNode() + .withReceiver(isUntypedReferenceNode("f")) + .withHasEffects(false) + .withArgs( + isUntypedArgsNode() + .withPositional(isSequence()) + .withNamed(isSequence()) + ) + ); + } +} -- cgit v1.2.3