diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-12-03 18:13:30 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-12-03 18:13:30 +0000 |
| commit | 8decaba8f75d16550d5f0e6caf9ddaff18dad38a (patch) | |
| tree | 281c39b4933542b69c6189f087d472dfb76bb918 /src/test/java | |
| parent | 0bcd3fbadef087b2b3ed6e4f398f6e6c36f11209 (diff) | |
Support exception handler method break
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/patio/PatioCodeGenEffectHandlerBreakTests.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenEffectHandlerBreakTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenEffectHandlerBreakTests.java new file mode 100644 index 00000000..128f001a --- /dev/null +++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenEffectHandlerBreakTests.java @@ -0,0 +1,31 @@ +package org.shedlang.compiler.patio; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.shedlang.compiler.patio.ast.operands.PatioLocalRef; +import org.shedlang.compiler.shid.instructions.Shid; +import org.shedlang.compiler.testing.snapshots.SnapshotResolver; +import org.shedlang.compiler.testing.snapshots.Snapshotter; +import org.shedlang.compiler.types.Effects; +import org.shedlang.compiler.types.NamespaceName; + +import java.io.IOException; + +import static org.shedlang.compiler.patio.PatioTesting.serialize; + +@ExtendWith({SnapshotResolver.class}) +public class PatioCodeGenEffectHandlerBreakTests { + @Test + public void effectHandlerBreakThrowsException(Snapshotter snapshotter) throws IOException { + var namespaceName = NamespaceName.of("Example", "Project"); + var effect = Effects.userDefined(namespaceName, "Effect"); + var shid = Shid.effectHandlerBreak(effect); + var context = PatioCodeGenContext.EMPTY + .temporaryPush(new PatioLocalRef("a")) + .temporaryPush(new PatioLocalRef("b")); + + var result = PatioCodeGen.generateInstruction(shid, context); + + snapshotter.assertSnapshot(serialize(result)); + } +} |
