summaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-07-03 14:57:30 +0100
committerMichael Williamson <mike@zwobble.org>2026-07-03 14:57:30 +0100
commit139dc93bb10daea87eba99e8f28d8a668c94e13b (patch)
tree95b3778099493b58381b21d3d2636b5b82320ce4 /src/test/java/org/zwobble
parent79721bda16ed9a941a714f1cdb1db9b1cf40316c (diff)
Add self type path segment
Diffstat (limited to 'src/test/java/org/zwobble')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java9
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathIdentSegmentSelfTypeMatcher.java33
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
+}