Cole-Greer commented on code in PR #3091:
URL: https://github.com/apache/tinkerpop/pull/3091#discussion_r2033958811
##########
gremlin-language/src/test/java/org/apache/tinkerpop/gremlin/language/grammar/ReferenceGrammarTest.java:
##########
@@ -89,29 +94,73 @@ public class ReferenceGrammarTest extends
AbstractGrammarTest {
}};
@Parameterized.Parameters(name = "{0}")
- public static Iterable<String> queries() throws IOException {
- final Set<String> gremlins = new
LinkedHashSet<>(DocumentationReader.parse(docsDir));
- gremlins.addAll(FeatureReader.parseGrouped(featureDir,
stringMatcherConverters).values().stream().flatMap(Collection::stream).collect(Collectors.toList()));
- return gremlins;
+ public static Iterable<Pair<String, ParserRule>> parseTestItems() throws
IOException {
+ // gremlin scripts from docs
+ final Set<Pair<String, ParserRule>> scripts =
DocumentationReader.parse(docsDir).
+ stream().map(g -> Pair.with(g, ParserRule.QUERY_LIST)).
+ collect(Collectors.toCollection(LinkedHashSet::new));
+
+ // helps make sure we're actually adding test scripts for each load.
there are well over 500 gremlin
+ // examples in the docs so we should have at least that much
+ int size = scripts.size();
+ assert size > 500;
+
+ // gremlin scripts from feature tests
+ scripts.addAll(FeatureReader.parseGrouped(featureDir,
stringMatcherConverters).values().stream().
+ flatMap(Collection::stream).
+ map(g -> Pair.with(g, ParserRule.QUERY_LIST)).
+ collect(Collectors.toList()));
+
+ // there are well over 1000 tests so make sure we parsed something
sensible
+ assert size < scripts.size() + 1000;
Review Comment:
```suggestion
assert size + 1000 < scripts.size();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]