diff options
Diffstat (limited to 'src/test/java/org/zwobble')
2 files changed, 42 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 d139a3b..4c337d5 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 @@ -439,6 +439,15 @@ public class RustWriterTests { assertThat(string, equalTo("::a::b")); } + @Test + public void selfTypeSegmentIsWritten() throws IOException { + var rust = RustTypePath.selfType(); + + var string = write(writer -> writer.writeType(rust)); + + assertThat(string, equalTo("Self")); + } + // == Identifiers == @Test diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathIdentSegmentSelfTypeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathIdentSegmentSelfTypeMatcher.java new file mode 100644 index 0000000..18ab20a --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathIdentSegmentSelfTypeMatcher.java @@ -0,0 +1,33 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; + +// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentSelfTypeMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentSelfTypeMatcher imports + +public class RustPathIdentSegmentSelfTypeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentSelfTypeMatcher isRustPathIdentSegmentSelfType() { + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentSelfTypeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentSelfType>> submatchers; + + private RustPathIdentSegmentSelfTypeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentSelfType>> 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.RustPathIdentSegmentSelfType.class, this.submatchers); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentSelfTypeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentSelfTypeMatcher body +} |
