MCPcopy Index your code
hub / github.com/apache/groovy / testBaseScript

Method testBaseScript

src/test/groovy/groovy/lang/ScriptTest.java:60–74  ·  view source on GitHub ↗

GROOVY-6582 : Script.invokeMethod bypasses getProperty when looking for closure-valued properties. Make sure that getProperty and invokeMethod are consistent.

()

Source from the content-addressed store, hash-verified

58 * Make sure that getProperty and invokeMethod are consistent.
59 */
60 @Test
61 void testBaseScript() {
62 String script = "" +
63 "abstract class DeclaredBaseScript extends Script {\n" +
64 " def v = { it * 2 }\n" +
65 " def z = { it * 3 }\n" +
66 " def getProperty(String n) { n == 'c' ? v : super.getProperty(n) }\n" +
67 "}\n" +
68 "@groovy.transform.BaseScript DeclaredBaseScript baseScript\n" +
69 "assert c(2) == 4\n" +
70 "assert z(2) == 6";
71
72 GroovyShell shell = new GroovyShell();
73 shell.evaluate(script);
74 }
75
76 // GROOVY-6344
77 @Test

Callers

nothing calls this directly

Calls 1

evaluateMethod · 0.95

Tested by

no test coverage detected