You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2021/03/16 20:44:30 UTC

[groovy] branch master updated: GROOVY-7944: add test case

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

emilles 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 953e8fc  GROOVY-7944: add test case
953e8fc is described below

commit 953e8fc7bbe0bb3cfe39546bbba5c4edb7c14864
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Tue Mar 16 15:44:20 2021 -0500

    GROOVY-7944: add test case
---
 src/test/gls/innerClass/InnerClassTest.groovy | 37 ++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/src/test/gls/innerClass/InnerClassTest.groovy b/src/test/gls/innerClass/InnerClassTest.groovy
index e8436f7..ceae77c 100644
--- a/src/test/gls/innerClass/InnerClassTest.groovy
+++ b/src/test/gls/innerClass/InnerClassTest.groovy
@@ -293,8 +293,39 @@ final class InnerClassTest {
         '''
     }
 
-    @Test @NotYetImplemented
+    @Test // GROOVY-7944
     void testNonStaticInnerClass2() {
+        assertScript '''
+            class A {
+                class B {
+                }
+                static main(args) {
+                    new B(new A())
+                    new A().with {
+                        new B(it)
+                        new B(delegate)
+                    }
+                }
+            }
+        '''
+
+        def err = shouldFail '''
+            class A {
+                class B {
+                }
+                static main(args) {
+                    new A().with {
+                        new B(this)
+                        new B(owner)
+                    }
+                }
+            }
+        '''
+        assert err =~ 'Could not find matching constructor for: A\\$B\\(Class\\)'
+    }
+
+    @Test @NotYetImplemented
+    void testNonStaticInnerClass3() {
         shouldFail CompilationFailedException, '''
             class A {
                 class B {}
@@ -304,7 +335,7 @@ final class InnerClassTest {
     }
 
     @Test @NotYetImplemented // GROOVY-9781
-    void testNonStaticInnerClass3() {
+    void testNonStaticInnerClass4() {
         assertScript '''
             class A {
                 class B {
@@ -323,7 +354,7 @@ final class InnerClassTest {
     }
 
     @Test @NotYetImplemented // GROOVY-8104
-    void testNonStaticInnerClass4() {
+    void testNonStaticInnerClass5() {
         assertScript '''
             class A {
                 void foo() {