From 7e1063d13f4d810ec8520367e7a5a1e9438d05aa Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 19 Jul 2023 21:24:53 +0100 Subject: Add Patio code gen for push-int --- .../compiler/patio/PatioCodeGenPushIntTests.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushIntTests.java (limited to 'src/test/java') diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushIntTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushIntTests.java new file mode 100644 index 00000000..5b1d7064 --- /dev/null +++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenPushIntTests.java @@ -0,0 +1,23 @@ +package org.shedlang.compiler.patio; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.shedlang.compiler.stackir.instructions.Instructions; +import org.shedlang.compiler.testing.snapshots.SnapshotResolver; +import org.shedlang.compiler.testing.snapshots.Snapshotter; + +import java.io.IOException; + +import static org.shedlang.compiler.patio.PatioTesting.serialize; + +@ExtendWith({SnapshotResolver.class}) +public class PatioCodeGenPushIntTests { + @Test + public void pushIntInstructionGeneratesPushIntInstruction(Snapshotter snapshotter) throws IOException { + var stackIr = Instructions.pushInt(42); + + var result = PatioCodeGen.generateInstruction(stackIr); + + snapshotter.assertSnapshot(serialize(result)); + } +} -- cgit v1.2.3