diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-06-06 19:42:44 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-06-06 19:42:44 +0100 |
| commit | 9d66911592c3e3f34aaafdd09c7dd9d96e720e18 (patch) | |
| tree | 0e033546c49d221163f85d60f52f608a8b8f137e /src/test/java/org/shedlang/compiler/parser | |
| parent | 7c358460db1c42a5b7e79b7c6706ebf2adcff39f (diff) | |
Parse call with no effects and no args
Diffstat (limited to 'src/test/java/org/shedlang/compiler/parser')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/parser/ParserCallTests.java | 29 |
1 files changed, 29 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 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()) + ) + ); + } +} |
