diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-21 12:42:18 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-21 12:42:18 +0100 |
| commit | 2c3d90f2c9a6cbcbe0c5dc6758b326539aa7a9b1 (patch) | |
| tree | 29d323e52b50679e777d095b97e5e26387156c61 /src/test/java | |
| parent | 511304a1a553249a2d26f8b6ac227190641ec614 (diff) | |
Add Patio code gen for namespace imports
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/patio/PatioCodeGenNamespaceImportTests.java | 27 |
1 files changed, 27 insertions, 0 deletions
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)); + } +} |
