This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch GROOVY_2_5_X in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 57ac9e8c80bd18a079e4832dcd71c42b06b07cf8 Author: Eric Milles <[email protected]> AuthorDate: Sat Jul 6 20:52:02 2019 -0500 Fix test cases affected by declaration expression getText() change --- .../swingui/ScriptToTreeNodeAdapterTest.groovy | 23 ++++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy b/subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy index 2e64fea..7893275 100644 --- a/subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy +++ b/subprojects/groovy-console/src/test/groovy/groovy/inspect/swingui/ScriptToTreeNodeAdapterTest.groovy @@ -29,17 +29,17 @@ import junit.framework.AssertionFailedError * * The assertions in this test case often assert against the toString() representation of * an object. Normally, this is bad form. However, the class under test is meant to display - * toString() forms in a user interface. So in this case it is appropriate. + * toString() forms in a user interface. So in this case it is appropriate. */ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { private final classLoader = new GroovyClassLoader() - + private createAdapter(showScriptFreeForm, showScriptClass, showClosureClasses) { def nodeMaker = new SwingTreeNodeMaker() new ScriptToTreeNodeAdapter(classLoader, showScriptFreeForm, showScriptClass, showClosureClasses, nodeMaker) } - + /** * Asserts that a given script produces the expected tree like * structure. @@ -48,7 +48,7 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { ScriptToTreeNodeAdapter adapter = createAdapter(true, true, true) assertTreeStructure(script, specification, adapter) } - + private assertTreeStructure(String script, List<Closure> specification, ScriptToTreeNodeAdapter adapter) { assertTreeStructure(script, CompilePhase.SEMANTIC_ANALYSIS, specification, adapter) } @@ -127,7 +127,6 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { } void testHelloWorld() { - assertTreeStructure( '"Hello World"', [ @@ -138,7 +137,6 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { } void testSimpleClass() { - assertTreeStructure( ' class Foo { public aField } ', [ @@ -150,7 +148,6 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { } void testMethodWithParameter() { - assertTreeStructure( ' def foo(String bar) { println bar } ', [ @@ -163,7 +160,6 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { } void testMethodWithParameterAndInitialValue() { - assertTreeStructure( ' def foo(String bar = "some_value") { println bar } ', [ @@ -177,13 +173,12 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { } void testClosureParameters() { - assertTreeStructure( ' def x = { parm1 -> println parm1 } ', [ eq('BlockStatement - (1)'), startsWith('ExpressionStatement'), - startsWith('Declaration - (x ='), + startsWith('Declaration - def x ='), startsWith('ClosureExpression'), startsWith('Parameter - parm1'), ] @@ -191,13 +186,12 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { } void testClosureParametersWithInitialValue() { - assertTreeStructure( ' def x = { parm1 = "some_value" -> println parm1 } ', [ eq('BlockStatement - (1)'), startsWith('ExpressionStatement'), - startsWith('Declaration - (x ='), + startsWith('Declaration - def x ='), eq('ClosureExpression'), startsWith('Parameter - parm1'), startsWith('Constant - some_value : java.lang.String'), @@ -231,7 +225,6 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { } void testDynamicVariable() { - assertTreeStructure( " foo = 'bar' ", [ @@ -264,7 +257,7 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { [ startsWith('BlockStatement'), startsWith('ExpressionStatement'), - eq('Declaration - ((x, y) = [1, 2])'), + eq('Declaration - def (x, y) = [1, 2]'), eq('ArgumentList - (x, y)'), ] ) @@ -411,7 +404,7 @@ class ScriptToTreeNodeAdapterTest extends GroovyTestCase { adapter ) } - + // since script class is being loaded, it should go through assertTreeStructure( 'def foo(String bar) {}',
