aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-15 11:04:35 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-15 11:05:27 +0000
commit7fd41e35c1a5a700555ad92c47a303764221dc3b (patch)
tree225c4c934aaf900aa6e6ae7308f6e743c4fd22cd /src/test/java
parent064da0faa9be28c68db6cda29387e4968542e886 (diff)
Update naming for Shid matchers
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenAssignTests.java32
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenBlockReturnTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenBoolLiteralTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenBreakTests.java6
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenCallTests.java14
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenEffectDefinitionTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenExpressionStatementTests.java8
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenFieldAccessTests.java17
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionDefinitionTests.java26
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionExpressionTests.java22
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionReturnTests.java6
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenIfTests.java44
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntAddTests.java10
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntEqualsTests.java8
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntLiteralTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntNotEqualTests.java8
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntSubTests.java8
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenNamespaceTests.java34
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenReferenceTests.java10
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenResumeTests.java6
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringAddTests.java8
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringLiteralTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenStructDefinitionTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenSumTypeDefinitionTests.java8
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenTryTests.java8
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenTupleTests.java10
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenUnitLiteralTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenValTests.java54
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenVarTests.java6
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhenTests.java18
-rw-r--r--src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhileTests.java46
-rw-r--r--src/test/java/org/shedlang/compiler/shid/instructions/ShidMatchers.java (renamed from src/test/java/org/shedlang/compiler/shid/instructions/InstructionMatchers.java)84
32 files changed, 265 insertions, 264 deletions
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenAssignTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenAssignTests.java
index 65e30e5a..caf83bc2 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenAssignTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenAssignTests.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.ast.typed.Typed;
import java.util.List;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -22,8 +22,8 @@ public class ShidCodeGenAssignTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("x__0"),
- isDiscardInstruction()
+ isShidLocalLoad("x__0"),
+ isShidDiscard()
));
}
@@ -39,8 +39,8 @@ public class ShidCodeGenAssignTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello"),
- isVarStoreInstruction("x__0")
+ isShidPushString("hello"),
+ isShidVarStore("x__0")
));
}
@@ -63,15 +63,15 @@ public class ShidCodeGenAssignTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("x__0"),
- isDuplicateInstruction(),
- isTupleGetInstruction(0),
- isLocalStoreInstruction("a__0"),
- isDuplicateInstruction(),
- isTupleGetInstruction(1),
- isLocalStoreInstruction("b__0"),
- isTupleGetInstruction(2),
- isLocalStoreInstruction("c__0")
+ isShidLocalLoad("x__0"),
+ isShidDuplicate(),
+ isShidTupleGet(0),
+ isShidLocalStore("a__0"),
+ isShidDuplicate(),
+ isShidTupleGet(1),
+ isShidLocalStore("b__0"),
+ isShidTupleGet(2),
+ isShidLocalStore("c__0")
));
}
@@ -87,8 +87,8 @@ public class ShidCodeGenAssignTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("x__0"),
- isDiscardInstruction()
+ isShidLocalLoad("x__0"),
+ isShidDiscard()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBlockReturnTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBlockReturnTests.java
index 082560b7..d5da9edd 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBlockReturnTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBlockReturnTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushStringInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushString;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -16,7 +16,7 @@ public class ShidCodeGenBlockReturnTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello")
+ isShidPushString("hello")
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBoolLiteralTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBoolLiteralTests.java
index 965f9b3c..2949ec70 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBoolLiteralTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBoolLiteralTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushBoolInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushBool;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -16,7 +16,7 @@ public class ShidCodeGenBoolLiteralTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushBoolInstruction(true)
+ isShidPushBool(true)
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBreakTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBreakTests.java
index 90823945..aa931f9e 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBreakTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenBreakTests.java
@@ -6,7 +6,7 @@ import org.shedlang.compiler.types.Effects;
import org.shedlang.compiler.types.NamespaceName;
import org.shedlang.compiler.types.UserDefinedEffect;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -22,8 +22,8 @@ public class ShidCodeGenBreakTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello"),
- isBreakInstruction(EFFECT)
+ isShidPushString("hello"),
+ isShidEffectHandlerBreak(EFFECT)
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenCallTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenCallTests.java
index 5d14cc31..e315b752 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenCallTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenCallTests.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.ast.typed.Typed;
import java.util.List;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -30,12 +30,12 @@ public class ShidCodeGenCallTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("f__0"),
- isPushStringInstruction("p1"),
- isPushStringInstruction("p2"),
- isPushStringInstruction("n2"),
- isPushStringInstruction("n1"),
- isCallInstruction(2, List.of("x2", "x1"))
+ isShidLocalLoad("f__0"),
+ isShidPushString("p1"),
+ isShidPushString("p2"),
+ isShidPushString("n2"),
+ isShidPushString("n1"),
+ isShidCall(2, List.of("x2", "x1"))
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenEffectDefinitionTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenEffectDefinitionTests.java
index 4777f5a7..af601953 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenEffectDefinitionTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenEffectDefinitionTests.java
@@ -6,7 +6,7 @@ import org.shedlang.compiler.shid.instructions.ShidDefineEffect;
import org.shedlang.compiler.types.Effects;
import org.shedlang.compiler.types.NamespaceName;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isLocalStoreInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidLocalStore;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.*;
@@ -25,7 +25,7 @@ public class ShidCodeGenEffectDefinitionTests {
ShidDefineEffect.class,
has("effect", x -> x.effect(), equalTo(effect))
),
- isLocalStoreInstruction("State__0")
+ isShidLocalStore("State__0")
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenExpressionStatementTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenExpressionStatementTests.java
index 05a47d39..8d3735f6 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenExpressionStatementTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenExpressionStatementTests.java
@@ -3,8 +3,8 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isDiscardInstruction;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushStringInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidDiscard;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushString;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -17,8 +17,8 @@ public class ShidCodeGenExpressionStatementTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello"),
- isDiscardInstruction()
+ isShidPushString("hello"),
+ isShidDiscard()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFieldAccessTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFieldAccessTests.java
index 0e869445..27559724 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFieldAccessTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFieldAccessTests.java
@@ -3,12 +3,13 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
import org.shedlang.compiler.shid.instructions.ShidFieldLoad;
+import org.shedlang.compiler.shid.instructions.ShidMatchers;
import org.shedlang.compiler.types.Effects;
import org.shedlang.compiler.types.NamespaceName;
import org.shedlang.compiler.types.Types;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isFieldLoadInstruction;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isLocalLoadInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidFieldLoad;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidLocalLoad;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -27,8 +28,8 @@ public class ShidCodeGenFieldAccessTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("Project__0"),
- isFieldLoadInstruction(
+ isShidLocalLoad("Project__0"),
+ ShidMatchers.isShidFieldLoad(
new ShidFieldLoad.Receiver.Namespace(namespaceType.namespaceName()),
"name"
)
@@ -49,8 +50,8 @@ public class ShidCodeGenFieldAccessTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("user__0"),
- isFieldLoadInstruction(structType, "name")
+ isShidLocalLoad("user__0"),
+ isShidFieldLoad(structType, "name")
));
}
@@ -68,8 +69,8 @@ public class ShidCodeGenFieldAccessTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("State__0"),
- isFieldLoadInstruction(
+ isShidLocalLoad("State__0"),
+ ShidMatchers.isShidFieldLoad(
new ShidFieldLoad.Receiver.Effect(effect),
"read"
)
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionDefinitionTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionDefinitionTests.java
index e0c63896..e26551b7 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionDefinitionTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionDefinitionTests.java
@@ -6,7 +6,7 @@ import org.shedlang.compiler.ast.typed.TypedFunctionDefinitionNode;
import org.shedlang.compiler.shid.instructions.ShidDefineFunction;
import org.shedlang.compiler.types.Types;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.*;
@@ -31,22 +31,22 @@ public class ShidCodeGenFunctionDefinitionTests {
ShidDefineFunction.class,
has("name", x -> x.name(), equalTo("f")),
has("positionalParams", x -> x.positionalParams(), isSequence(
- isDefineFunctionInstructionParam("x__0")
+ isShidDefineFunction("x__0")
)),
has("namedParams", x -> x.namedParams(), isSequence(
- isDefineFunctionInstructionParam("y__0")
+ isShidDefineFunction("y__0")
)),
has("freeVariables", x -> x.freeVariables(), containsExactly(
has("name", x -> x.name(), equalTo("z__0"))
)),
- has("body", x -> x.body(), isBlockInstruction(isSequence(
- isPushStringInstruction("hello"),
- isDiscardInstruction(),
- isPushUnitInstruction(),
- isReturnInstruction()
+ has("body", x -> x.body(), isShidBlock(isSequence(
+ isShidPushString("hello"),
+ isShidDiscard(),
+ isShidPushUnit(),
+ isShidReturn()
)))
),
- isLocalStoreInstruction("f__0")
+ isShidLocalStore("f__0")
));
}
@@ -64,12 +64,12 @@ public class ShidCodeGenFunctionDefinitionTests {
assertThat(result.instructions(), isSequence(
instanceOf(
ShidDefineFunction.class,
- has("body", x -> x.body(), isBlockInstruction(isSequence(
- isPushStringInstruction("hello"),
- isReturnInstruction()
+ has("body", x -> x.body(), isShidBlock(isSequence(
+ isShidPushString("hello"),
+ isShidReturn()
)))
),
- isLocalStoreInstruction("f__0")
+ isShidLocalStore("f__0")
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionExpressionTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionExpressionTests.java
index 2783a389..ae7c42f1 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionExpressionTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionExpressionTests.java
@@ -6,7 +6,7 @@ import org.shedlang.compiler.ast.typed.TypedFunctionExpressionNode;
import org.shedlang.compiler.shid.instructions.ShidDefineFunction;
import org.shedlang.compiler.types.Types;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.*;
@@ -30,19 +30,19 @@ public class ShidCodeGenFunctionExpressionTests {
ShidDefineFunction.class,
has("name", x -> x.name(), equalTo("anonymous")),
has("positionalParams", x -> x.positionalParams(), isSequence(
- isDefineFunctionInstructionParam("x__0")
+ isShidDefineFunction("x__0")
)),
has("namedParams", x -> x.namedParams(), isSequence(
- isDefineFunctionInstructionParam("y__0")
+ isShidDefineFunction("y__0")
)),
has("freeVariables", x -> x.freeVariables(), containsExactly(
has("name", x -> x.name(), equalTo("z__0"))
)),
- has("body", x -> x.body(), isBlockInstruction(isSequence(
- isPushStringInstruction("hello"),
- isDiscardInstruction(),
- isPushUnitInstruction(),
- isReturnInstruction()
+ has("body", x -> x.body(), isShidBlock(isSequence(
+ isShidPushString("hello"),
+ isShidDiscard(),
+ isShidPushUnit(),
+ isShidReturn()
)))
)
));
@@ -61,9 +61,9 @@ public class ShidCodeGenFunctionExpressionTests {
assertThat(result.instructions(), isSequence(
instanceOf(
ShidDefineFunction.class,
- has("body", x -> x.body(), isBlockInstruction(isSequence(
- isPushStringInstruction("hello"),
- isReturnInstruction()
+ has("body", x -> x.body(), isShidBlock(isSequence(
+ isShidPushString("hello"),
+ isShidReturn()
)))
)
));
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionReturnTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionReturnTests.java
index d6a63c1f..ddef4d90 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionReturnTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenFunctionReturnTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -16,8 +16,8 @@ public class ShidCodeGenFunctionReturnTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello"),
- isReturnInstruction()
+ isShidPushString("hello"),
+ isShidReturn()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIfTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIfTests.java
index df07214d..8f21f322 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIfTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIfTests.java
@@ -6,7 +6,7 @@ import org.shedlang.compiler.types.Types;
import java.util.List;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -33,15 +33,15 @@ public class ShidCodeGenIfTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("c__0"),
- isIfInstruction(
- isBlockInstruction(isSequence(
- isPushIntInstruction(42)
+ isShidLocalLoad("c__0"),
+ isShidIf(
+ isShidBlock(isSequence(
+ isShidPushInt(42)
)),
- isBlockInstruction(isSequence(
- isBlockInstruction(isSequence(
- isPushStringInstruction("x"),
- isReturnInstruction()
+ isShidBlock(isSequence(
+ isShidBlock(isSequence(
+ isShidPushString("x"),
+ isShidReturn()
))
))
)
@@ -77,21 +77,21 @@ public class ShidCodeGenIfTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("c__0"),
- isIfInstruction(
- isBlockInstruction(isSequence(
- isPushIntInstruction(42)
+ isShidLocalLoad("c__0"),
+ isShidIf(
+ isShidBlock(isSequence(
+ isShidPushInt(42)
)),
- isBlockInstruction(isSequence(
- isLocalLoadInstruction("d__0"),
- isIfInstruction(
- isBlockInstruction(isSequence(
- isPushIntInstruction(1)
+ isShidBlock(isSequence(
+ isShidLocalLoad("d__0"),
+ isShidIf(
+ isShidBlock(isSequence(
+ isShidPushInt(1)
)),
- isBlockInstruction(isSequence(
- isBlockInstruction(isSequence(
- isPushStringInstruction("x"),
- isReturnInstruction()
+ isShidBlock(isSequence(
+ isShidBlock(isSequence(
+ isShidPushString("x"),
+ isShidReturn()
))
))
)
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntAddTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntAddTests.java
index 4ff0e6eb..631e372c 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntAddTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntAddTests.java
@@ -3,8 +3,8 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isIntAddInstruction;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushIntInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidIntAdd;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushInt;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -20,9 +20,9 @@ public class ShidCodeGenIntAddTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushIntInstruction(42),
- isPushIntInstruction(47),
- isIntAddInstruction()
+ isShidPushInt(42),
+ isShidPushInt(47),
+ isShidIntAdd()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntEqualsTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntEqualsTests.java
index 464e73f4..68265547 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntEqualsTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntEqualsTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -19,9 +19,9 @@ public class ShidCodeGenIntEqualsTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushIntInstruction(42),
- isPushIntInstruction(47),
- isIntEqualsInstruction()
+ isShidPushInt(42),
+ isShidPushInt(47),
+ isShidIntEquals()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntLiteralTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntLiteralTests.java
index ed95e765..e9b85302 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntLiteralTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntLiteralTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushIntInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushInt;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -16,7 +16,7 @@ public class ShidCodeGenIntLiteralTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushIntInstruction(42)
+ isShidPushInt(42)
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntNotEqualTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntNotEqualTests.java
index 9c55f222..6c645ea4 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntNotEqualTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntNotEqualTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -19,9 +19,9 @@ public class ShidCodeGenIntNotEqualTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushIntInstruction(42),
- isPushIntInstruction(47),
- isIntNotEqualInstruction()
+ isShidPushInt(42),
+ isShidPushInt(47),
+ isShidIntNotEqual()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntSubTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntSubTests.java
index df3e9791..6cd3495a 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntSubTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenIntSubTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -19,9 +19,9 @@ public class ShidCodeGenIntSubTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushIntInstruction(42),
- isPushIntInstruction(47),
- isIntSubInstruction()
+ isShidPushInt(42),
+ isShidPushInt(47),
+ isShidIntSub()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenNamespaceTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenNamespaceTests.java
index 8caf7ba6..1e6a1000 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenNamespaceTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenNamespaceTests.java
@@ -8,7 +8,7 @@ import org.shedlang.compiler.types.Types;
import java.util.List;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.*;
@@ -33,7 +33,7 @@ public class ShidCodeGenNamespaceTests {
var shidNamespace = ShidCodeGen.compileNamespace(node);
- assertThat(shidNamespace.body(), isBlockInstruction(isSequence(
+ assertThat(shidNamespace.body(), isShidBlock(isSequence(
// TODO: test the builtin loading properly
instanceOf(ShidNamespaceImport.class),
instanceOf(ShidFieldLoad.class),
@@ -43,9 +43,9 @@ public class ShidCodeGenNamespaceTests {
ShidDefineFunction.class,
has("name", x -> x.name(), equalTo("f"))
),
- isLocalStoreInstruction("f__0"),
- isLocalLoadInstruction("f__0"),
- isNamespaceFieldStoreInstruction(namespaceName, "f")
+ isShidLocalStore("f__0"),
+ isShidLocalLoad("f__0"),
+ isShidNamespaceFieldStore(namespaceName, "f")
)));
}
@@ -60,16 +60,16 @@ public class ShidCodeGenNamespaceTests {
var shidNamespace = ShidCodeGen.compileNamespace(node);
- assertThat(shidNamespace.body(), isBlockInstruction(isSequence(
+ assertThat(shidNamespace.body(), isShidBlock(isSequence(
// TODO: test the builtin loading properly
instanceOf(ShidNamespaceImport.class),
instanceOf(ShidFieldLoad.class),
instanceOf(ShidLocalStore.class),
- isNamespaceImportInstruction(NamespaceName.of("A")),
- isLocalStoreInstruction("A__0"),
- isNamespaceImportInstruction(NamespaceName.of("B")),
- isLocalStoreInstruction("B__0")
+ isShidNamespaceImport(NamespaceName.of("A")),
+ isShidLocalStore("A__0"),
+ isShidNamespaceImport(NamespaceName.of("B")),
+ isShidLocalStore("B__0")
)));
}
@@ -93,7 +93,7 @@ public class ShidCodeGenNamespaceTests {
var shidNamespace = ShidCodeGen.compileNamespace(node);
- assertThat(shidNamespace.body(), isBlockInstruction(isSequence(
+ assertThat(shidNamespace.body(), isShidBlock(isSequence(
// TODO: test the builtin loading properly
instanceOf(ShidNamespaceImport.class),
instanceOf(ShidFieldLoad.class),
@@ -103,16 +103,16 @@ public class ShidCodeGenNamespaceTests {
ShidDefineStruct.class,
has("type", x -> x.type(), equalTo(structType))
),
- isLocalStoreInstruction("None__0"),
+ isShidLocalStore("None__0"),
instanceOf(
ShidDefineFunction.class,
has("name", x -> x.name(), equalTo("f"))
),
- isLocalStoreInstruction("f__0"),
- isLocalLoadInstruction("f__0"),
- isNamespaceFieldStoreInstruction(namespaceName, "f"),
- isLocalLoadInstruction("None__0"),
- isNamespaceFieldStoreInstruction(namespaceName, "None")
+ isShidLocalStore("f__0"),
+ isShidLocalLoad("f__0"),
+ isShidNamespaceFieldStore(namespaceName, "f"),
+ isShidLocalLoad("None__0"),
+ isShidNamespaceFieldStore(namespaceName, "None")
)));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenReferenceTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenReferenceTests.java
index c60d54de..2cad5cb5 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenReferenceTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenReferenceTests.java
@@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.BoundVariable;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -18,7 +18,7 @@ public class ShidCodeGenReferenceTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("x__0")
+ isShidLocalLoad("x__0")
));
}
@@ -35,9 +35,9 @@ public class ShidCodeGenReferenceTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushIntInstruction(0),
- isVarStoreInstruction("x__0"),
- isVarLoadInstruction("x__0")
+ isShidPushInt(0),
+ isShidVarStore("x__0"),
+ isShidVarLoad("x__0")
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenResumeTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenResumeTests.java
index 6992783d..727d07a4 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenResumeTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenResumeTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -16,8 +16,8 @@ public class ShidCodeGenResumeTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello"),
- isResumeInstruction()
+ isShidPushString("hello"),
+ isShidResume()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringAddTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringAddTests.java
index 56b2750e..387839a7 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringAddTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringAddTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -19,9 +19,9 @@ public class ShidCodeGenStringAddTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("a"),
- isPushStringInstruction("b"),
- isStringAddInstruction()
+ isShidPushString("a"),
+ isShidPushString("b"),
+ isShidStringAdd()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringLiteralTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringLiteralTests.java
index b308c300..5cc85089 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringLiteralTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStringLiteralTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushStringInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushString;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -16,7 +16,7 @@ public class ShidCodeGenStringLiteralTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello")
+ isShidPushString("hello")
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStructDefinitionTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStructDefinitionTests.java
index 4e989e9b..c3a932df 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStructDefinitionTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenStructDefinitionTests.java
@@ -7,7 +7,7 @@ import org.shedlang.compiler.shid.instructions.ShidDefineStruct;
import org.shedlang.compiler.types.NamespaceName;
import org.shedlang.compiler.types.Types;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isLocalStoreInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidLocalStore;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.*;
@@ -34,7 +34,7 @@ public class ShidCodeGenStructDefinitionTests {
has("name", x -> x.name(), equalTo("isActive"))
))
),
- isLocalStoreInstruction("User__0")
+ isShidLocalStore("User__0")
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenSumTypeDefinitionTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenSumTypeDefinitionTests.java
index 74521d29..be7ca7d1 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenSumTypeDefinitionTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenSumTypeDefinitionTests.java
@@ -5,8 +5,8 @@ import org.shedlang.compiler.ast.typed.Typed;
import org.shedlang.compiler.types.NamespaceName;
import org.shedlang.compiler.types.Types;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isLocalStoreInstruction;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushUnitInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidLocalStore;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushUnit;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -23,8 +23,8 @@ public class ShidCodeGenSumTypeDefinitionTests {
var result = ShidCodeGen.compileNamespaceStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushUnitInstruction(),
- isLocalStoreInstruction("Option__0")
+ isShidPushUnit(),
+ isShidLocalStore("Option__0")
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenTryTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenTryTests.java
index ddcf1d08..c155eb4d 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenTryTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenTryTests.java
@@ -9,8 +9,8 @@ import org.shedlang.compiler.shid.instructions.ShidTry;
import org.shedlang.compiler.types.Effects;
import org.shedlang.compiler.types.NamespaceName;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isBlockInstruction;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushIntInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidBlock;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushInt;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.*;
@@ -55,8 +55,8 @@ public class ShidCodeGenTryTests {
equalTo("read"),
equalTo("write")
)),
- has("body", x -> x.body(), isBlockInstruction(isSequence(
- isPushIntInstruction(42)
+ has("body", x -> x.body(), isShidBlock(isSequence(
+ isShidPushInt(42)
)))
)
));
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenTupleTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenTupleTests.java
index c3194182..dde77436 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenTupleTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenTupleTests.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.ast.typed.Typed;
import java.util.List;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -22,10 +22,10 @@ public class ShidCodeGenTupleTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("a"),
- isPushBoolInstruction(true),
- isPushIntInstruction(4),
- isTupleCreateInstruction(3)
+ isShidPushString("a"),
+ isShidPushBool(true),
+ isShidPushInt(4),
+ isShidTupleCreate(3)
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenUnitLiteralTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenUnitLiteralTests.java
index 27b7ed6c..511c2f5e 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenUnitLiteralTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenUnitLiteralTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.isPushUnitInstruction;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushUnit;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -16,7 +16,7 @@ public class ShidCodeGenUnitLiteralTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isPushUnitInstruction()
+ isShidPushUnit()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenValTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenValTests.java
index fdf9300c..1e220855 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenValTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenValTests.java
@@ -7,7 +7,7 @@ import org.shedlang.compiler.types.Types;
import java.util.List;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -21,8 +21,8 @@ public class ShidCodeGenValTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello"),
- isLocalStoreInstruction("x__0")
+ isShidPushString("hello"),
+ isShidLocalStore("x__0")
));
}
@@ -35,8 +35,8 @@ public class ShidCodeGenValTests {
var result = ShidCodeGen.compileNamespaceStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello"),
- isLocalStoreInstruction("x__0")
+ isShidPushString("hello"),
+ isShidLocalStore("x__0")
));
}
@@ -77,32 +77,32 @@ public class ShidCodeGenValTests {
}
assertThat(context.instructions(), isSequence(
- isPushIntInstruction(10),
- isLocalStoreInstruction("x__0"),
- isLocalLoadInstruction("x__0"),
- isDiscardInstruction(),
- isPushBoolInstruction(true),
- isIfInstruction(
- isBlockInstruction(isSequence(
- isPushIntInstruction(11),
- isLocalStoreInstruction("x__1"),
- isLocalLoadInstruction("x__1"),
- isDiscardInstruction(),
- isPushUnitInstruction()
+ isShidPushInt(10),
+ isShidLocalStore("x__0"),
+ isShidLocalLoad("x__0"),
+ isShidDiscard(),
+ isShidPushBool(true),
+ isShidIf(
+ isShidBlock(isSequence(
+ isShidPushInt(11),
+ isShidLocalStore("x__1"),
+ isShidLocalLoad("x__1"),
+ isShidDiscard(),
+ isShidPushUnit()
)),
- isBlockInstruction(isSequence(
- isBlockInstruction(isSequence(
- isPushIntInstruction(12),
- isLocalStoreInstruction("x__2"),
- isLocalLoadInstruction("x__2"),
- isDiscardInstruction(),
- isPushUnitInstruction()
+ isShidBlock(isSequence(
+ isShidBlock(isSequence(
+ isShidPushInt(12),
+ isShidLocalStore("x__2"),
+ isShidLocalLoad("x__2"),
+ isShidDiscard(),
+ isShidPushUnit()
))
))
),
- isDiscardInstruction(),
- isLocalLoadInstruction("x__0"),
- isDiscardInstruction()
+ isShidDiscard(),
+ isShidLocalLoad("x__0"),
+ isShidDiscard()
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenVarTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenVarTests.java
index a1e264ad..1f9c24e8 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenVarTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenVarTests.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -17,8 +17,8 @@ public class ShidCodeGenVarTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isPushStringInstruction("hello"),
- isVarStoreInstruction("x__0")
+ isShidPushString("hello"),
+ isShidVarStore("x__0")
));
}
}
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhenTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhenTests.java
index a7abfc69..b7529685 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhenTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhenTests.java
@@ -7,7 +7,7 @@ import org.shedlang.compiler.types.Types;
import java.util.List;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -40,19 +40,19 @@ public class ShidCodeGenWhenTests {
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
- isLocalLoadInstruction("x__0"),
- isSwitchInstruction(
+ isShidLocalLoad("x__0"),
+ isShidSwitch(
isSequence(
- isSwitchInstructionCase(
+ isShidSwitchCase(
Types.struct(NAMESPACE_NAME, "A"),
- isBlockInstruction(isSequence(
- isPushStringInstruction("a")
+ isShidBlock(isSequence(
+ isShidPushString("a")
))
),
- isSwitchInstructionCase(
+ isShidSwitchCase(
Types.struct(NAMESPACE_NAME, "B"),
- isBlockInstruction(isSequence(
- isPushStringInstruction("b")
+ isShidBlock(isSequence(
+ isShidPushString("b")
))
)
)
diff --git a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhileTests.java b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhileTests.java
index 3307db91..5e1ce2c4 100644
--- a/src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhileTests.java
+++ b/src/test/java/org/shedlang/compiler/shid/ShidCodeGenWhileTests.java
@@ -5,7 +5,7 @@ import org.shedlang.compiler.ast.typed.Typed;
import java.util.List;
-import static org.shedlang.compiler.shid.instructions.InstructionMatchers.*;
+import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
@@ -24,20 +24,20 @@ public class ShidCodeGenWhileTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isLoopInstruction(
- isBlockInstruction(isSequence(
- isLocalLoadInstruction("c__0"),
- isIfInstruction(
- isBlockInstruction(isSequence()),
- isBlockInstruction(isSequence(
- isLoopBreakInstruction()
+ isShidLoop(
+ isShidBlock(isSequence(
+ isShidLocalLoad("c__0"),
+ isShidIf(
+ isShidBlock(isSequence()),
+ isShidBlock(isSequence(
+ isShidLoopBreak()
))
),
- isBlockInstruction(isSequence(
- isPushIntInstruction(42),
- isDiscardInstruction()
+ isShidBlock(isSequence(
+ isShidPushInt(42),
+ isShidDiscard()
)),
- isLoopContinueInstruction()
+ isShidLoopContinue()
))
)
));
@@ -59,20 +59,20 @@ public class ShidCodeGenWhileTests {
var result = ShidCodeGen.compileFunctionStatement(node, context);
assertThat(result.instructions(), isSequence(
- isLoopInstruction(
- isBlockInstruction(isSequence(
- isLocalLoadInstruction("c__0"),
- isIfInstruction(
- isBlockInstruction(isSequence()),
- isBlockInstruction(isSequence(
- isLoopBreakInstruction()
+ isShidLoop(
+ isShidBlock(isSequence(
+ isShidLocalLoad("c__0"),
+ isShidIf(
+ isShidBlock(isSequence()),
+ isShidBlock(isSequence(
+ isShidLoopBreak()
))
),
- isBlockInstruction(isSequence(
- isPushIntInstruction(42),
- isDiscardInstruction()
+ isShidBlock(isSequence(
+ isShidPushInt(42),
+ isShidDiscard()
)),
- isLoopContinueInstruction()
+ isShidLoopContinue()
))
)
));
diff --git a/src/test/java/org/shedlang/compiler/shid/instructions/InstructionMatchers.java b/src/test/java/org/shedlang/compiler/shid/instructions/ShidMatchers.java
index 6e57a4b2..70de8644 100644
--- a/src/test/java/org/shedlang/compiler/shid/instructions/InstructionMatchers.java
+++ b/src/test/java/org/shedlang/compiler/shid/instructions/ShidMatchers.java
@@ -10,11 +10,11 @@ import java.util.List;
import static org.zwobble.precisely.Matchers.*;
-public class InstructionMatchers {
- private InstructionMatchers() {
+public class ShidMatchers {
+ private ShidMatchers() {
}
- public static Matcher<ShidInstruction> isBlockInstruction(
+ public static Matcher<ShidInstruction> isShidBlock(
Matcher<Iterable<? extends ShidInstruction>> instructions
) {
return instanceOf(
@@ -23,14 +23,7 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidInstruction> isBreakInstruction(UserDefinedEffect effect) {
- return instanceOf(
- ShedEffectHandlerBreak.class,
- has("effect", x -> x.effect(), equalTo(effect))
- );
- }
-
- public static Matcher<ShidInstruction> isCallInstruction(
+ public static Matcher<ShidInstruction> isShidCall(
int positionalArgCount,
List<String> namedArgNames
) {
@@ -41,21 +34,28 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidDefineFunction.Param> isDefineFunctionInstructionParam(String name) {
+ public static Matcher<ShidDefineFunction.Param> isShidDefineFunction(String name) {
return has("name", x -> x.name(), equalTo(name));
}
- public static Matcher<ShidInstruction> isDiscardInstruction() {
+ public static Matcher<ShidInstruction> isShidDiscard() {
return instanceOf(
ShidDiscard.class
);
}
- public static Matcher<ShidInstruction> isDuplicateInstruction() {
+ public static Matcher<ShidInstruction> isShidDuplicate() {
return instanceOf(ShidDuplicate.class);
}
- public static Matcher<ShidInstruction> isFieldLoadInstruction(
+ public static Matcher<ShidInstruction> isShidEffectHandlerBreak(UserDefinedEffect effect) {
+ return instanceOf(
+ ShedEffectHandlerBreak.class,
+ has("effect", x -> x.effect(), equalTo(effect))
+ );
+ }
+
+ public static Matcher<ShidInstruction> isShidFieldLoad(
ShidFieldLoad.Receiver receiver,
String fieldName
) {
@@ -66,17 +66,17 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidInstruction> isFieldLoadInstruction(
+ public static Matcher<ShidInstruction> isShidFieldLoad(
StructType receiverType,
String fieldName
) {
- return isFieldLoadInstruction(
+ return isShidFieldLoad(
new ShidFieldLoad.Receiver.Struct(receiverType),
fieldName
);
}
- public static Matcher<ShidInstruction> isIfInstruction(
+ public static Matcher<ShidInstruction> isShidIf(
Matcher<? super ShidBlock> trueBody,
Matcher<? super ShidBlock> falseBody
) {
@@ -87,37 +87,37 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidInstruction> isIntAddInstruction() {
+ public static Matcher<ShidInstruction> isShidIntAdd() {
return instanceOf(ShidIntAdd.class);
}
- public static Matcher<ShidInstruction> isIntEqualsInstruction() {
+ public static Matcher<ShidInstruction> isShidIntEquals() {
return instanceOf(ShidIntEquals.class);
}
- public static Matcher<ShidInstruction> isIntNotEqualInstruction() {
+ public static Matcher<ShidInstruction> isShidIntNotEqual() {
return instanceOf(ShidIntNotEqual.class);
}
- public static Matcher<ShidInstruction> isIntSubInstruction() {
+ public static Matcher<ShidInstruction> isShidIntSub() {
return instanceOf(ShidIntSub.class);
}
- public static Matcher<ShidInstruction> isLocalLoadInstruction(String name) {
+ public static Matcher<ShidInstruction> isShidLocalLoad(String name) {
return instanceOf(
ShidLocalLoad.class,
has("name", x -> x.name(), equalTo(name))
);
}
- public static Matcher<ShidInstruction> isLocalStoreInstruction(String name) {
+ public static Matcher<ShidInstruction> isShidLocalStore(String name) {
return instanceOf(
ShidLocalStore.class,
has("name", x -> x.name(), equalTo(name))
);
}
- public static Matcher<ShidInstruction> isLoopInstruction(
+ public static Matcher<ShidInstruction> isShidLoop(
Matcher<? super ShidBlock> body
) {
return instanceOf(
@@ -126,15 +126,15 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidInstruction> isLoopBreakInstruction() {
+ public static Matcher<ShidInstruction> isShidLoopBreak() {
return instanceOf(ShidLoopBreak.class);
}
- public static Matcher<ShidInstruction> isLoopContinueInstruction() {
+ public static Matcher<ShidInstruction> isShidLoopContinue() {
return instanceOf(ShidLoopContinue.class);
}
- public static Matcher<ShidInstruction> isNamespaceFieldStoreInstruction(
+ public static Matcher<ShidInstruction> isShidNamespaceFieldStore(
NamespaceName namespaceName,
String fieldName
) {
@@ -145,7 +145,7 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidInstruction> isNamespaceImportInstruction(
+ public static Matcher<ShidInstruction> isShidNamespaceImport(
NamespaceName namespaceName
) {
return instanceOf(
@@ -154,50 +154,50 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidInstruction> isPushBoolInstruction(boolean value) {
+ public static Matcher<ShidInstruction> isShidPushBool(boolean value) {
return instanceOf(
ShidPushBool.class,
has("value", x -> x.value(), equalTo(value))
);
}
- public static Matcher<ShidInstruction> isPushIntInstruction(int value) {
+ public static Matcher<ShidInstruction> isShidPushInt(int value) {
return instanceOf(
ShidPushInt.class,
has("value", x -> x.value(), equalTo(BigInteger.valueOf(value)))
);
}
- public static Matcher<ShidInstruction> isPushStringInstruction(String value) {
+ public static Matcher<ShidInstruction> isShidPushString(String value) {
return instanceOf(
ShidPushString.class,
has("value", x -> x.value(), equalTo(value))
);
}
- public static Matcher<ShidInstruction> isPushUnitInstruction() {
+ public static Matcher<ShidInstruction> isShidPushUnit() {
return instanceOf(
ShidPushUnit.class
);
}
- public static Matcher<ShidInstruction> isResumeInstruction() {
+ public static Matcher<ShidInstruction> isShidResume() {
return instanceOf(
ShidResume.class
);
}
- public static Matcher<ShidInstruction> isReturnInstruction() {
+ public static Matcher<ShidInstruction> isShidReturn() {
return instanceOf(
ShidReturn.class
);
}
- public static Matcher<ShidInstruction> isStringAddInstruction() {
+ public static Matcher<ShidInstruction> isShidStringAdd() {
return instanceOf(ShidStringAdd.class);
}
- public static Matcher<ShidInstruction> isSwitchInstruction(
+ public static Matcher<ShidInstruction> isShidSwitch(
Matcher<Iterable<? extends ShidSwitch.Case>> cases
) {
return instanceOf(
@@ -206,7 +206,7 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidSwitch.Case> isSwitchInstructionCase(
+ public static Matcher<ShidSwitch.Case> isShidSwitchCase(
StructType caseType,
Matcher<? super ShidBlock> body
) {
@@ -216,28 +216,28 @@ public class InstructionMatchers {
);
}
- public static Matcher<ShidInstruction> isTupleCreateInstruction(int elementCount) {
+ public static Matcher<ShidInstruction> isShidTupleCreate(int elementCount) {
return instanceOf(
ShidTupleCreate.class,
has("elementCount", x -> x.elementCount(), equalTo(elementCount))
);
}
- public static Matcher<ShidInstruction> isTupleGetInstruction(int elementIndex) {
+ public static Matcher<ShidInstruction> isShidTupleGet(int elementIndex) {
return instanceOf(
ShidTupleGet.class,
has("elementIndex", x -> x.elementIndex(), equalTo(elementIndex))
);
}
- public static Matcher<ShidInstruction> isVarLoadInstruction(String name) {
+ public static Matcher<ShidInstruction> isShidVarLoad(String name) {
return instanceOf(
ShidVarLoad.class,
has("name", x -> x.name(), equalTo(name))
);
}
- public static Matcher<ShidInstruction> isVarStoreInstruction(String name) {
+ public static Matcher<ShidInstruction> isShidVarStore(String name) {
return instanceOf(
ShidVarStore.class,
has("name", x -> x.name(), equalTo(name))