diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-14 21:15:55 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-14 21:15:55 +0100 |
| commit | 3e9a68f0235158f5ee2c70cb6b319b26e42fd810 (patch) | |
| tree | 7f6ac5762feb9bff047f67e7e77ba48f9fc45e96 /src/test/java/org/zwobble | |
| parent | e5f4a367a810d70a6f2cbe048ca1fd78549f1d28 (diff) | |
Combine Rust notions of paths
Diffstat (limited to 'src/test/java/org/zwobble')
9 files changed, 72 insertions, 175 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 67d0a42..358d99d 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 @@ -56,8 +56,8 @@ public class RustWriterTests { public void functionWithParams() throws IOException { var rust = RustFunction.arbitrary() .withName(new RustIdentifier("area")) - .addParam(new RustFunctionParam(new RustIdentifier("width"), RustTypePath.of("i32"))) - .addParam(new RustFunctionParam(new RustIdentifier("height"), RustTypePath.of("u64"))) + .addParam(new RustFunctionParam(new RustIdentifier("width"), RustPath.of("i32"))) + .addParam(new RustFunctionParam(new RustIdentifier("height"), RustPath.of("u64"))) .build(); var string = write(writer -> writer.writeAssociatedItem(rust)); @@ -70,7 +70,7 @@ public class RustWriterTests { public void functionWithReturnType() throws IOException { var rust = RustFunction.arbitrary() .withName(new RustIdentifier("area")) - .withReturnType(Optional.of(RustTypePath.of("i32"))) + .withReturnType(Optional.of(RustPath.of("i32"))) .build(); var string = write(writer -> writer.writeAssociatedItem(rust)); @@ -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"), Optional.empty()), - new RustOuterAttribute(RustTypePath.of("derive"), Optional.of("(Debug)")) + new RustOuterAttribute(RustPath.of("a", "b", "C"), Optional.empty()), + new RustOuterAttribute(RustPath.of("derive"), Optional.of("(Debug)")) )) .build(); @@ -133,8 +133,8 @@ public class RustWriterTests { var rust = RustStructStruct.arbitrary() .withName(new RustIdentifier("Rectangle")) .withFields(List.of( - new RustStructField(new RustIdentifier("width"), RustTypePath.of("i32")), - new RustStructField(new RustIdentifier("height"), RustTypePath.of("i32")) + new RustStructField(new RustIdentifier("width"), RustPath.of("i32")), + new RustStructField(new RustIdentifier("height"), RustPath.of("i32")) )) .build(); @@ -180,8 +180,8 @@ public class RustWriterTests { var rust = RustEnum.arbitrary() .withName(new RustIdentifier("Shape")) .withAttributes(List.of( - new RustOuterAttribute(RustTypePath.of("a", "b", "C"), Optional.empty()), - new RustOuterAttribute(RustTypePath.of("derive"), Optional.of("(Debug)")) + new RustOuterAttribute(RustPath.of("a", "b", "C"), Optional.empty()), + new RustOuterAttribute(RustPath.of("derive"), Optional.of("(Debug)")) )) .build(); @@ -229,8 +229,8 @@ public class RustWriterTests { .withFields( RustEnumVariantTuple.arbitrary() .withFields(List.of( - RustTupleField.arbitrary().withType(RustTypePath.of("i32")).build(), - RustTupleField.arbitrary().withType(RustTypePath.of("i32")).build() + RustTupleField.arbitrary().withType(RustPath.of("i32")).build(), + RustTupleField.arbitrary().withType(RustPath.of("i32")).build() )) .build() ) @@ -240,7 +240,7 @@ public class RustWriterTests { .withFields( RustEnumVariantTuple.arbitrary() .withFields(List.of( - RustTupleField.arbitrary().withType(RustTypePath.of("u64")).build() + RustTupleField.arbitrary().withType(RustPath.of("u64")).build() )) .build() ) @@ -276,7 +276,7 @@ public class RustWriterTests { @Test public void emptyInherentImpl() throws IOException { - var rust = RustInherentImpl.arbitrary().withType(RustTypePath.of("Square")).build(); + var rust = RustInherentImpl.arbitrary().withType(RustPath.of("Square")).build(); var string = write(writer -> writer.writeItem(rust)); @@ -288,7 +288,7 @@ public class RustWriterTests { @Test public void inherentImplWithAssociatedItems() throws IOException { var rust = RustInherentImpl.arbitrary() - .withType(RustTypePath.of("Square")) + .withType(RustPath.of("Square")) .addItem(RustFunction.arbitrary().withName(new RustIdentifier("width"))) .addItem(RustFunction.arbitrary().withName(new RustIdentifier("height"))) .build(); @@ -306,8 +306,8 @@ public class RustWriterTests { @Test public void emptyTraitImpl() throws IOException { var rust = RustTraitImpl.arbitrary() - .withImplementedTrait(RustTypePath.of("Shape")) - .withType(RustTypePath.of("Square")) + .withImplementedTrait(RustPath.of("Shape")) + .withType(RustPath.of("Square")) .build(); var string = write(writer -> writer.writeItem(rust)); @@ -320,8 +320,8 @@ public class RustWriterTests { @Test public void traitImplWithAssociatedItems() throws IOException { var rust = RustTraitImpl.arbitrary() - .withImplementedTrait(RustTypePath.of("Shape")) - .withType(RustTypePath.of("Square")) + .withImplementedTrait(RustPath.of("Shape")) + .withType(RustPath.of("Square")) .addItem(RustFunction.arbitrary().withName(new RustIdentifier("width"))) .addItem(RustFunction.arbitrary().withName(new RustIdentifier("height"))) .build(); @@ -445,7 +445,7 @@ public class RustWriterTests { @Test public void callExpressionWithNoArgs() throws IOException { var rust = RustCallExpression.arbitrary() - .withFunction(RustPathInExpression.of("f")) + .withFunction(RustPath.of("f")) .build(); var string = write(writer -> writer.writeExpression(rust)); @@ -456,9 +456,9 @@ public class RustWriterTests { @Test public void callExpressionWithArgs() throws IOException { var rust = RustCallExpression.arbitrary() - .withFunction(RustPathInExpression.of("f")) - .addArg(RustPathInExpression.of("x")) - .addArg(RustPathInExpression.of("y")) + .withFunction(RustPath.of("f")) + .addArg(RustPath.of("x")) + .addArg(RustPath.of("y")) .build(); var string = write(writer -> writer.writeExpression(rust)); @@ -471,7 +471,7 @@ public class RustWriterTests { @Test public void fieldExpression() throws IOException { var rust = RustFieldExpression.arbitrary() - .withContainerOperand(RustPathInExpression.of("x")) + .withContainerOperand(RustPath.of("x")) .withFieldName(RustIdentifier.of("y")) .build(); @@ -485,7 +485,7 @@ public class RustWriterTests { @Test public void structExpressionWithNoFields() throws IOException { var rust = RustStructExpression.arbitrary() - .withStructPath(RustPathInExpression.of("A")) + .withStructPath(RustPath.of("A")) .build(); var string = write(writer -> writer.writeExpression(rust)); @@ -496,16 +496,16 @@ public class RustWriterTests { @Test public void structExpressionWithFields() throws IOException { var rust = RustStructExpression.arbitrary() - .withStructPath(RustPathInExpression.of("X")) + .withStructPath(RustPath.of("X")) .addFieldValue( RustStructExprField.arbitrary() .withName(RustIdentifier.of("a")) - .withValue(RustPathInExpression.of("b")) + .withValue(RustPath.of("b")) ) .addFieldValue( RustStructExprField.arbitrary() .withName(RustIdentifier.of("c")) - .withValue(RustPathInExpression.of("d")) + .withValue(RustPath.of("d")) ) .build(); @@ -519,7 +519,7 @@ public class RustWriterTests { @Test public void implTraitType() throws IOException { var rust = RustImplTraitType.arbitrary() - .withTrait(RustTypePath.of("std", "io", "Read")) + .withTrait(RustPath.of("std", "io", "Read")) .build(); var string = write(writer -> writer.writeType(rust)); @@ -530,8 +530,8 @@ public class RustWriterTests { // == Paths == @Test - public void pathExprSegmentsAreSeparatedByDoubleColons() throws IOException { - var rust = RustPathInExpression.of("std", "string", "String"); + public void pathSegmentsAreSeparatedByDoubleColons() throws IOException { + var rust = RustPath.of("std", "string", "String"); var string = write(writer -> writer.writeExpression(rust)); @@ -539,9 +539,9 @@ public class RustWriterTests { } @Test - public void pathExprSegmentGenericArgsAreWritten() throws IOException { - var rust = RustPathInExpression.of("std", "collections", "HashMap") - .withArgs(List.of(RustTypePath.of("i32"), RustTypePath.of("f64"))); + public void pathSegmentGenericArgsAreWritten() throws IOException { + var rust = RustPath.of("std", "collections", "HashMap") + .withArgs(List.of(RustPath.of("i32"), RustPath.of("f64"))); var string = write(writer -> writer.writeExpression(rust)); @@ -549,27 +549,8 @@ public class RustWriterTests { } @Test - public void typePathSegmentsAreSeparatedByDoubleColons() throws IOException { - var rust = RustTypePath.of("std", "string", "String"); - - var string = write(writer -> writer.writeType(rust)); - - assertThat(string, equalTo("std::string::String")); - } - - @Test - public void typePathSegmentGenericArgsAreWritten() throws IOException { - var rust = RustTypePath.of("std", "collections", "HashMap") - .withArgs(List.of(RustTypePath.of("i32"), RustTypePath.of("f64"))); - - var string = write(writer -> writer.writeType(rust)); - - assertThat(string, equalTo("std::collections::HashMap<i32, f64>")); - } - - @Test public void crateSegmentIsWritten() throws IOException { - var rust = RustTypePath.crate("a", "b"); + var rust = RustPath.crate("a", "b"); var string = write(writer -> writer.writeType(rust)); @@ -578,7 +559,7 @@ public class RustWriterTests { @Test public void globalSegmentIsWritten() throws IOException { - var rust = RustTypePath.global("a", "b"); + var rust = RustPath.global("a", "b"); var string = write(writer -> writer.writeType(rust)); @@ -587,7 +568,7 @@ public class RustWriterTests { @Test public void selfTypeSegmentIsWritten() throws IOException { - var rust = RustTypePath.selfType(); + var rust = RustPath.selfType(); var string = write(writer -> writer.writeType(rust)); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustImplTraitTypeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustImplTraitTypeMatcher.java index 02afb08..0ad0925 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustImplTraitTypeMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustImplTraitTypeMatcher.java @@ -28,7 +28,7 @@ public class RustImplTraitTypeMatcher implements org.zwobble.precisely.Matcher<j return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitType.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitTypeMatcher withTrait(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath> trait) { + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitTypeMatcher withTrait(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath> trait) { var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitType>>(this.submatchers); submatchers.add(org.zwobble.precisely.Matchers.has("trait", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitType::trait, trait)); return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitTypeMatcher(submatchers); 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 7aceb9e..03707bc 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 @@ -28,7 +28,7 @@ public class RustOuterAttributeMatcher implements org.zwobble.precisely.Matcher< return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttribute.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher withPath(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath> path) { + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher withPath(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath> path) { 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("path", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttribute::path, path)); return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher(submatchers); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathInExpressionMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathMatcher.java index 4fad401..eb382d0 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathInExpressionMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathMatcher.java @@ -2,17 +2,17 @@ package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; -// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher imports -// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher imports +// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher imports -public class RustPathInExpressionMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { - public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher isRustPathInExpression() { - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher(java.util.List.of()); +public class RustPathMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher isRustPath() { + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher(java.util.List.of()); } - private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpression>> submatchers; + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath>> submatchers; - private RustPathInExpressionMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpression>> submatchers) { + private RustPathMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath>> submatchers) { this.submatchers = submatchers; } @@ -25,15 +25,15 @@ public class RustPathInExpressionMatcher implements org.zwobble.precisely.Matche } private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { - return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpression.class, this.submatchers); + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher withSegments(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment>> segments) { - var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpression>>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("segments", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpression::segments, segments)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher(submatchers); + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher withSegments(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment>> segments) { + var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath>>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("segments", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath::segments, segments)); + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher(submatchers); } - // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher body - // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher body + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher body } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathExprSegmentMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathSegmentMatcher.java index 04fbe5b..7db3593 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathExprSegmentMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathSegmentMatcher.java @@ -2,17 +2,17 @@ package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; -// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher imports -// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher imports +// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher imports -public class RustPathExprSegmentMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { - public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher isRustPathExprSegment() { - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher(java.util.List.of()); +public class RustPathSegmentMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher isRustPathSegment() { + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher(java.util.List.of()); } - private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment>> submatchers; + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment>> submatchers; - private RustPathExprSegmentMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment>> submatchers) { + private RustPathSegmentMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment>> submatchers) { this.submatchers = submatchers; } @@ -25,21 +25,21 @@ public class RustPathExprSegmentMatcher implements org.zwobble.precisely.Matcher } private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { - return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment.class, this.submatchers); + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher withPathIdentSegment(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegment> pathIdentSegment) { - var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment>>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("pathIdentSegment", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment::pathIdentSegment, pathIdentSegment)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher(submatchers); + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher withPathIdentSegment(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegment> pathIdentSegment) { + var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment>>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("pathIdentSegment", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment::pathIdentSegment, pathIdentSegment)); + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher(submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher withArgs(org.zwobble.precisely.Matcher<? super java.util.Optional<java.util.List<org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustType>>> args) { - var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment>>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("args", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment::args, args)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher(submatchers); + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher withArgs(org.zwobble.precisely.Matcher<? super java.util.Optional<java.util.List<org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustType>>> args) { + var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment>>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("args", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment::args, args)); + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher(submatchers); } - // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher body - // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher body + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher body } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustStructExpressionMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustStructExpressionMatcher.java index 5597d00..20f8ec7 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustStructExpressionMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustStructExpressionMatcher.java @@ -28,7 +28,7 @@ public class RustStructExpressionMatcher implements org.zwobble.precisely.Matche return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpression.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpressionMatcher withStructPath(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpression> structPath) { + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpressionMatcher withStructPath(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath> structPath) { var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpression>>(this.submatchers); submatchers.add(org.zwobble.precisely.Matchers.has("structPath", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpression::structPath, structPath)); return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpressionMatcher(submatchers); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTraitImplMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTraitImplMatcher.java index a31ac13..9d31b3f 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTraitImplMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTraitImplMatcher.java @@ -28,7 +28,7 @@ public class RustTraitImplMatcher implements org.zwobble.precisely.Matcher<java. return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImpl.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImplMatcher withImplementedTrait(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath> implementedTrait) { + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImplMatcher withImplementedTrait(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath> implementedTrait) { var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImpl>>(this.submatchers); submatchers.add(org.zwobble.precisely.Matchers.has("implementedTrait", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImpl::implementedTrait, implementedTrait)); return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImplMatcher(submatchers); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathMatcher.java deleted file mode 100644 index 4a12993..0000000 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathMatcher.java +++ /dev/null @@ -1,39 +0,0 @@ -// Generated by hobgoblin. - -package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; - -// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher imports -// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher imports - -public class RustTypePathMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { - public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher isRustTypePath() { - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher(java.util.List.of()); - } - - private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath>> submatchers; - - private RustTypePathMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath>> 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.RustTypePath.class, this.submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher withSegments(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment>> segments) { - var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath>>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("segments", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath::segments, segments)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher(submatchers); - } - - // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher body - // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher body -} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathSegmentMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathSegmentMatcher.java deleted file mode 100644 index d3ccd10..0000000 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathSegmentMatcher.java +++ /dev/null @@ -1,45 +0,0 @@ -// Generated by hobgoblin. - -package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; - -// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher imports -// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher imports - -public class RustTypePathSegmentMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { - public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher isRustTypePathSegment() { - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher(java.util.List.of()); - } - - private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment>> submatchers; - - private RustTypePathSegmentMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment>> 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.RustTypePathSegment.class, this.submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher withPathIdentSegment(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathIdentSegment> pathIdentSegment) { - var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment>>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("pathIdentSegment", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment::pathIdentSegment, pathIdentSegment)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher(submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher withArgs(org.zwobble.precisely.Matcher<? super java.util.Optional<java.util.List<org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustType>>> args) { - var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment>>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("args", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment::args, args)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher(submatchers); - } - - // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher body - // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher body -} |
