summaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/zwobble')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java22
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustMutableReferenceTypeMatcher.java39
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustSharedReferenceTypeMatcher.java39
3 files changed, 100 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java
index 7f85b8a..6900f83 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java
@@ -558,6 +558,28 @@ public class RustWriterTests {
assertThat(string, equalTo("impl std::io::Read"));
}
+ @Test
+ public void mutableReferenceType() throws IOException {
+ var rust = RustMutableReferenceType.arbitrary()
+ .withReferencedType(RustPath.of("i32"))
+ .build();
+
+ var string = write(writer -> writer.writeType(rust));
+
+ assertThat(string, equalTo("&mut i32"));
+ }
+
+ @Test
+ public void sharedReferenceType() throws IOException {
+ var rust = RustSharedReferenceType.arbitrary()
+ .withReferencedType(RustPath.of("i32"))
+ .build();
+
+ var string = write(writer -> writer.writeType(rust));
+
+ assertThat(string, equalTo("&i32"));
+ }
+
// == Paths ==
@Test
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustMutableReferenceTypeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustMutableReferenceTypeMatcher.java
new file mode 100644
index 0000000..875dac8
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustMutableReferenceTypeMatcher.java
@@ -0,0 +1,39 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.output.lang.rust.ast;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceTypeMatcher imports
+// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceTypeMatcher imports
+
+public class RustMutableReferenceTypeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> {
+ public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceTypeMatcher isRustMutableReferenceType() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceTypeMatcher(java.util.List.of());
+ }
+
+ private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceType>> submatchers;
+
+ private RustMutableReferenceTypeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceType>> submatchers) {
+ this.submatchers = submatchers;
+ }
+
+ public org.zwobble.precisely.MatchResult match(java.lang.Object actual) {
+ return this.toMatcher().match(actual);
+ }
+
+ public org.zwobble.precisely.TextTree describe() {
+ return this.toMatcher().describe();
+ }
+
+ private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() {
+ return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceType.class, this.submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceTypeMatcher withReferencedType(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustType> referencedType) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceType>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("referencedType", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceType::referencedType, referencedType));
+ return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceTypeMatcher(submatchers);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceTypeMatcher body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustMutableReferenceTypeMatcher body
+}
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustSharedReferenceTypeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustSharedReferenceTypeMatcher.java
new file mode 100644
index 0000000..1776707
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustSharedReferenceTypeMatcher.java
@@ -0,0 +1,39 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.output.lang.rust.ast;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceTypeMatcher imports
+// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceTypeMatcher imports
+
+public class RustSharedReferenceTypeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> {
+ public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceTypeMatcher isRustSharedReferenceType() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceTypeMatcher(java.util.List.of());
+ }
+
+ private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceType>> submatchers;
+
+ private RustSharedReferenceTypeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceType>> submatchers) {
+ this.submatchers = submatchers;
+ }
+
+ public org.zwobble.precisely.MatchResult match(java.lang.Object actual) {
+ return this.toMatcher().match(actual);
+ }
+
+ public org.zwobble.precisely.TextTree describe() {
+ return this.toMatcher().describe();
+ }
+
+ private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() {
+ return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceType.class, this.submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceTypeMatcher withReferencedType(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustType> referencedType) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceType>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("referencedType", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceType::referencedType, referencedType));
+ return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceTypeMatcher(submatchers);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceTypeMatcher body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustSharedReferenceTypeMatcher body
+}