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.java11
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustInherentImplMatcher.java39
2 files changed, 50 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 b5583ab..ea04006 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
@@ -128,6 +128,17 @@ public class RustWriterTests {
}
@Test
+ public void emptyInherentImpl() throws IOException {
+ var rust = RustInherentImpl.arbitrary().withType(RustTypePath.of("Square")).build();
+
+ var string = write(writer -> writer.writeItem(rust));
+
+ assertThat(string, equalTo("""
+ impl Square {
+ }"""));
+ }
+
+ @Test
public void emptyStruct() throws IOException {
var rust = RustStructStruct.arbitrary().withName(new RustIdentifier("Rectangle")).build();
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustInherentImplMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustInherentImplMatcher.java
new file mode 100644
index 0000000..23b23a1
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustInherentImplMatcher.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.RustInherentImplMatcher imports
+// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImplMatcher imports
+
+public class RustInherentImplMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> {
+ public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImplMatcher isRustInherentImpl() {
+ return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImplMatcher(java.util.List.of());
+ }
+
+ private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImpl>> submatchers;
+
+ private RustInherentImplMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImpl>> 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.RustInherentImpl.class, this.submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImplMatcher withType(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustType> type) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImpl>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("type", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImpl::type, type));
+ return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImplMatcher(submatchers);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImplMatcher body
+ // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustInherentImplMatcher body
+}