diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-14 19:43:56 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-14 19:43:56 +0100 |
| commit | 043bfe981db97daca8b543582d4114fd2aa3f7ec (patch) | |
| tree | f2e403e1ecb1432249557d40ac7a3be2546b7945 /src/test | |
| parent | 6cb75452ad193e1e40a092478ab527513a7e2bda (diff) | |
Support inputs in Rust attributes
Diffstat (limited to 'src/test')
2 files changed, 9 insertions, 3 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 b591058..62b361a 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 @@ -114,8 +114,8 @@ public class RustWriterTests { var rust = RustStructStruct.arbitrary() .withName(new RustIdentifier("Rectangle")) .withAttributes(List.of( - new RustOuterAttribute(RustTypePath.of("a", "b", "C")), - new RustOuterAttribute(RustTypePath.of("Debug")) + new RustOuterAttribute(RustTypePath.of("a", "b", "C"), Optional.empty()), + new RustOuterAttribute(RustTypePath.of("derive"), Optional.of("(Debug)")) )) .build(); @@ -123,7 +123,7 @@ public class RustWriterTests { assertThat(string, equalTo(""" #[a::b::C] - #[Debug] + #[derive(Debug)] pub struct Rectangle { }""")); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustOuterAttributeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustOuterAttributeMatcher.java index 6e1e930..7aceb9e 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustOuterAttributeMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustOuterAttributeMatcher.java @@ -34,6 +34,12 @@ public class RustOuterAttributeMatcher implements org.zwobble.precisely.Matcher< return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher(submatchers); } + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher withInput(org.zwobble.precisely.Matcher<? super java.util.Optional<String>> input) { + var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttribute>>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("input", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttribute::input, input)); + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher(submatchers); + } + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher body // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher body } |
