This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 99f8c65268 minor refactor: improve test robustness for groovysh on CI 
(cont'd)
99f8c65268 is described below

commit 99f8c65268a10036f6419739c67f26769ba32512
Author: Paul King <[email protected]>
AuthorDate: Mon May 25 12:43:04 2026 +1000

    minor refactor: improve test robustness for groovysh on CI (cont'd)
---
 .../groovysh/commands/HelpCommandTest.groovy       | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git 
a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/HelpCommandTest.groovy
 
b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/HelpCommandTest.groovy
index 12ec379986..1b2d5ed0df 100644
--- 
a/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/HelpCommandTest.groovy
+++ 
b/subprojects/groovy-groovysh/src/test/groovy/org/apache/groovy/groovysh/commands/HelpCommandTest.groovy
@@ -44,4 +44,36 @@ class HelpCommandTest extends SystemTestSupport {
         assert out.contains('show')
         assert out.contains('exit')
     }
+
+    /**
+     * TEMP DIAGNOSTIC — investigating the JDK-specific flake on 
helpListsKnownCommands.
+     * <p>
+     * Peeks at {@code SystemRegistryImpl.exception} after running {@code 
/help}.
+     * JLine's {@code helpTopic} silently stores any per-command exception 
there via
+     * {@code catch (Exception e) { exception = e; }}. If iteration aborts 
mid-list
+     * (one of the registered commands' {@code commandInfo}/description 
throws),
+     * we'd see the exception here.
+     * <p>
+     * Expected outcomes:
+     * <ul>
+     *   <li>{@code exception == null} → iteration ran to completion; the 
truncation
+     *       seen in the flake is pump-drain / native-terminal-binding 
timing.</li>
+     *   <li>{@code exception != null} → iteration aborted; the stack trace 
points
+     *       at the offending command.</li>
+     * </ul>
+     * Remove this test once the flake is understood.
+     */
+    @Test
+    void diagSilentExceptionAfterHelp() {
+        system.execute('/help')
+        def field = 
org.jline.console.impl.SystemRegistryImpl.class.getDeclaredField('exception')
+        field.setAccessible(true)
+        Exception ex = (Exception) field.get(system)
+        if (ex) {
+            ex.printStackTrace()
+            throw new AssertionError(
+                "SystemRegistryImpl.exception is non-null after /help: 
${ex.class.name}: ${ex.message}",
+                ex)
+        }
+    }
 }

Reply via email to