aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/shedlang/compiler/parser
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-06-06 19:42:44 +0100
committerMichael Williamson <mike@zwobble.org>2023-06-06 19:42:44 +0100
commit9d66911592c3e3f34aaafdd09c7dd9d96e720e18 (patch)
tree0e033546c49d221163f85d60f52f608a8b8f137e /src/test/java/org/shedlang/compiler/parser
parent7c358460db1c42a5b7e79b7c6706ebf2adcff39f (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.java29
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())
+ )
+ );
+ }
+}