Added coverage for gremlin-console and gremlin-language#3512
Open
GumpacG wants to merge 1 commit into
Open
Conversation
Assisted-by: Kiro: Claude Opus 4.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test coverage improvements
Two related but independent changes that improve test coverage in TinkerPop, each self-contained:
GremlinParsercoverage ingremlin-language.Both changes also remove dead code found while raising coverage. Removals are listed first, followed by a consolidated coverage summary with the before/after numbers and an explanation of why coverage doesn't go higher.
Dead code removed
gremlin-language / gremlin-core (grammar)
booleanArgument,dateArgument, andnullableGenericLiteralMapgrammar rules (unreachable fromqueryListaftertheir references were dropped in earlier changes), plus the coupled
gremlin-corebase-visitor stubs,ArgumentVisitor/TranslateVisitormethods, and obsolete
ArgumentVisitorTestcases. Regenerated thegremlin-jsparser and removed its dead
visitBooleanArgument.gremlin-console
Console.groovy: unused privatewriteTraverserToErrorLines.PluggedIn.groovy: never-instantiatedGroovyGremlinShellEnvironmentinner class.MockGroovyGremlinShellEnvironmenttest helper.Coverage
gremlin-console
Caveat: the standard build runs the pexpect tests in Docker without the JaCoCo agent, so CI's JaCoCo run won't reflect the pexpect-driven portion; the 83% figure was obtained by attaching the agent to the console JVM the pexpect tests spawn.
before (~50%):
after (~83%):
gremlin-language (grammar / GremlinParser)
GremlinParsermain rule class: 76.2% -> 81.2% instructions, 62.8% -> 69.2% branches.GremlinParser(gremlin-language + full gremlin-core suite): 57.5% -> 61.3%.before (~57%):


before (~60%):
GremlinParserbefore:GremlinParserafter:Why coverage doesn't go higher
gremlin-console
InstallCommand's successful dependency-download branch (the realGrape.grab+ post-download plugin load) needs Grape + network, so it can't run in the offline test environment.RemoteGremlinPluginand remote query submission only do real work against a live Gremlin Server. Covering them fromgremlin-consolewould require standing up an embedded server or adding a test dependency ongremlin-server/gremlin-driver- out of scope for this module, and already covered by those modules' own integration tests - so those paths are intentionally left unexercised here.StackOverflowErrorhint branch inhandleErrorstays uncovered: triggering a realStackOverflowErroron demand is flaky and depends on the JVM-Xssstack size, so a test for that single hint message would be brittle. (The other interactive error branches - the "Display stack trace? [yN]" y/n answers, theFailureformatter, and the non-interactive-escript-error exit - are covered by the pexpect suite.)gremlin-language (
GremlinParser)GremlinParseris ANTLR-generated, so the remaining uncovered code is eitherunreachable by valid input or only coverable by tests that assert nothing
meaningful. These additions already cover essentially all the reachable,
behaviour-bearing productions:
catch (RecognitionException)recovery block. The grammar test harness installsBailErrorStrategy, which aborts on the first error, so recovery is neverentered; reaching those blocks would mean re-parsing malformed input under a
non-bail error strategy the harness deliberately doesn't use. This is the single
largest uncovered bucket.
pre-empted by an earlier alternative that matches the same input (e.g.
by(Order)/by(T), and the nested-traversalhas/property/hasValueforms, which the
*_Objectalternatives subsume). ANTLR never builds thosecontext nodes, so no input can cover them; making them reachable would require
reordering the grammar (out of scope).
*Contextaccessor methods such asKeywordContextandTraversalGTypeContexttoken getters are never called(consumers read
ctx.getText()), and the generated no-op listener is unused.The only way to cover them is to invoke the generated getters directly, which
asserts nothing about behaviour, so such a test would only game the metric.
getSerializedATN,getATN,sempred, etc. areANTLR boilerplate; invoking them in a test would colour the lines without
verifying anything, so covering them would only inflate the number.