From 2c3d90f2c9a6cbcbe0c5dc6758b326539aa7a9b1 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 21 Jul 2023 12:42:18 +0100 Subject: Add Patio code gen for namespace imports --- .../patio/PatioCodeGenNamespaceImportTests.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/java/org/shedlang/compiler/patio/PatioCodeGenNamespaceImportTests.java (limited to 'src/test/java') diff --git a/src/test/java/org/shedlang/compiler/patio/PatioCodeGenNamespaceImportTests.java b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenNamespaceImportTests.java new file mode 100644 index 00000000..705e90dc --- /dev/null +++ b/src/test/java/org/shedlang/compiler/patio/PatioCodeGenNamespaceImportTests.java @@ -0,0 +1,27 @@ +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 org.shedlang.compiler.types.NamespaceName; + +import java.io.IOException; +import java.util.List; + +import static org.shedlang.compiler.patio.PatioTesting.serialize; + +@ExtendWith({SnapshotResolver.class}) +public class PatioCodeGenNamespaceImportTests { + @Test + public void canGenerateCodeForNamespaceImport(Snapshotter snapshotter) throws IOException { + var namespaceName = new NamespaceName(List.of("Example", "Project")); + var instruction = Instructions.namespaceImport(namespaceName); + var context = PatioCodeGenContext.EMPTY; + + var result = PatioCodeGen.generateInstruction(instruction, context); + + snapshotter.assertSnapshot(serialize(result)); + } +} -- cgit v1.2.3