diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-03 14:20:08 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-03 14:20:08 +0100 |
| commit | f70794a17a357c93014059f23db53fae4fcc578c (patch) | |
| tree | e004307403f70ab6ce439cf6defc9f54f13fa095 /src/test/java/org/zwobble | |
| parent | a0f29fd390a37f79348e583bf6cdf8eaafd556f3 (diff) | |
Support global Rust paths
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 d512181..a7bf391 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 @@ -378,6 +378,15 @@ public class RustWriterTests { } @Test + public void globalTypeSegmentIsWritten() throws IOException { + var rust = RustTypePath.global("a", "b"); + + var string = write(writer -> writer.writeType(rust)); + + assertThat(string, equalTo("::a::b")); + } + + @Test public void typeSegmentGenericArgsAreWritten() throws IOException { var rust = RustTypePath.of("std", "collections", "HashMap") .withArgs(List.of(RustTypePath.of("i32"), RustTypePath.of("f64"))); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathIdentSegmentGlobalMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathIdentSegmentGlobalMatcher.java new file mode 100644 index 0000000..cbe961d --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathIdentSegmentGlobalMatcher.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.RustPathIdentSegmentGlobalMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentGlobalMatcher imports + +public class RustPathIdentSegmentGlobalMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentGlobalMatcher isRustPathIdentSegmentGlobal() { + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentGlobalMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentGlobal>> submatchers; + + private RustPathIdentSegmentGlobalMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentGlobal>> 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.RustPathIdentSegmentGlobal.class, this.submatchers); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentGlobalMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegmentGlobalMatcher body +} |
