diff options
| author | Michael Williamson <mike@zwobble.org> | 2024-02-03 11:39:30 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2024-02-03 11:39:51 +0000 |
| commit | 2ec7f973ce084932ffe25516dc3fe27e2011450d (patch) | |
| tree | af59afa25fac6b454ce28ab58fc03aa0ef0ca507 /src/test/java | |
| parent | 96b78561204020df21703a5fe8922bf49dc6e1f4 (diff) | |
Add visibility to PatioDataElementImmutable
Diffstat (limited to 'src/test/java')
4 files changed, 20 insertions, 2 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java index 273ff21a..bc44f2ea 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java @@ -22,6 +22,7 @@ public abstract class PatioExampleTests { public void canLoadDataElementInt() throws IOException, InterruptedException { var patioDataElement = new PatioDataElementImmutable( "answer", + PatioVisibility.PRIVATE, PatioDataValues.int_(42), Sources.NULL ); @@ -53,6 +54,7 @@ public abstract class PatioExampleTests { public void canLoadIntFromMiddleOfDataElement() throws IOException, InterruptedException { var patioDataElement = new PatioDataElementImmutable( "answer", + PatioVisibility.PRIVATE, PatioDataValues.struct(List.of( PatioDataValues.int_(37), PatioDataValues.int_(42), diff --git a/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java b/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java index 3c27f7a3..baf1bdfd 100644 --- a/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java +++ b/src/test/java/org/shedlang/compiler/patio/PatioSerializerTests.java @@ -46,6 +46,7 @@ public class PatioSerializerTests { public void canSerializeDataElementImmutable() { var element = Patio.dataElementImmutable( "x", + PatioVisibility.PRIVATE, PatioDataValues.array( PatioDataLayouts.BYTE, List.of(PatioDataValues.byte_(0x01), PatioDataValues.byte_(0x02)) @@ -55,7 +56,7 @@ public class PatioSerializerTests { var string = PatioTesting.serializeCompilationUnitElement(element); assertThat(string, equalTo(""" - (data-immutable "x" (array byte ((byte 0x01) (byte 0x02))))""" + (data-immutable "x" private (array byte ((byte 0x01) (byte 0x02))))""" )); } diff --git a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java index c54e0c30..5c82321f 100644 --- a/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java +++ b/src/test/java/org/shedlang/compiler/patio/instructions/Patio.java @@ -84,9 +84,15 @@ public class Patio { public static PatioDataElementImmutable dataElementImmutable( String name, + PatioVisibility visibility, PatioDataValue value ) { - return new PatioDataElementImmutable(name, value, Sources.NULL); + return new PatioDataElementImmutable( + name, + visibility, + value, + Sources.NULL + ); } public static PatioDataElementMutable dataElementMutable( diff --git a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioContextTests.java b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioContextTests.java index b7a6cb34..634ca53a 100644 --- a/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioContextTests.java +++ b/src/test/java/org/shedlang/compiler/shidtopatio/ShidToPatioContextTests.java @@ -2,6 +2,7 @@ package org.shedlang.compiler.shidtopatio; import org.junit.jupiter.api.Test; import org.shedlang.compiler.patio.PatioDataElementImmutable; +import org.shedlang.compiler.patio.PatioVisibility; import org.shedlang.compiler.patio.types.PatioDataValues; import org.shedlang.compiler.shidtopatio.errors.DuplicateCompilationUnitElementName; import org.shedlang.compiler.sources.Sources; @@ -17,11 +18,13 @@ public class ShidToPatioContextTests { context = context.addCompilationUnitElement(new PatioDataElementImmutable( "x", + PatioVisibility.PRIVATE, PatioDataValues.int_(0), Sources.NULL )); context = context.addCompilationUnitElement(new PatioDataElementImmutable( "y", + PatioVisibility.PRIVATE, PatioDataValues.int_(0), Sources.NULL )); @@ -37,6 +40,7 @@ public class ShidToPatioContextTests { var context = ShidToPatioContext.EMPTY .addCompilationUnitElement(new PatioDataElementImmutable( "x", + PatioVisibility.PRIVATE, PatioDataValues.int_(0), Sources.NULL )); @@ -45,6 +49,7 @@ public class ShidToPatioContextTests { DuplicateCompilationUnitElementName.class, () -> context.addCompilationUnitElement(new PatioDataElementImmutable( "x", + PatioVisibility.PRIVATE, PatioDataValues.int_(0), Sources.NULL )) @@ -59,11 +64,13 @@ public class ShidToPatioContextTests { context = context.ensureCompilationUnitElement(new PatioDataElementImmutable( "x", + PatioVisibility.PRIVATE, PatioDataValues.int_(0), Sources.RUNTIME )); context = context.ensureCompilationUnitElement(new PatioDataElementImmutable( "x", + PatioVisibility.PRIVATE, PatioDataValues.int_(0), Sources.RUNTIME )); @@ -78,6 +85,7 @@ public class ShidToPatioContextTests { var context = ShidToPatioContext.EMPTY .ensureCompilationUnitElement(new PatioDataElementImmutable( "x", + PatioVisibility.PRIVATE, PatioDataValues.int_(0), Sources.RUNTIME )); @@ -86,6 +94,7 @@ public class ShidToPatioContextTests { DuplicateCompilationUnitElementName.class, () -> context.ensureCompilationUnitElement(new PatioDataElementImmutable( "x", + PatioVisibility.PRIVATE, PatioDataValues.int_(1), Sources.RUNTIME )) |
