Refine the test for GROOVY-8531

(cherry picked from commit 1b19f68)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e51be18e
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e51be18e
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e51be18e

Branch: refs/heads/GROOVY_2_5_X
Commit: e51be18e912e369ae9a32dc774444d3d33a778a8
Parents: 852d1e8
Author: danielsun1106 <realblue...@hotmail.com>
Authored: Fri Apr 6 15:04:50 2018 +0800
Committer: danielsun1106 <realblue...@hotmail.com>
Committed: Fri Apr 6 15:08:49 2018 +0800

----------------------------------------------------------------------
 .../groovy/bugs/groovy8531/Groovy8531Bug.groovy | 28 +++++++++++++++++++-
 src/test/groovy/bugs/groovy8531/Reducer.java    | 12 ++++++++-
 2 files changed, 38 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e51be18e/src/test/groovy/bugs/groovy8531/Groovy8531Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/groovy8531/Groovy8531Bug.groovy 
b/src/test/groovy/bugs/groovy8531/Groovy8531Bug.groovy
index 72dd08b..2369d88 100644
--- a/src/test/groovy/bugs/groovy8531/Groovy8531Bug.groovy
+++ b/src/test/groovy/bugs/groovy8531/Groovy8531Bug.groovy
@@ -25,6 +25,14 @@ class Groovy8531Bug extends GroovyTestCase {
             class Example extends Reducer {
                 public void reduce(PublicContext context) {}
                 public void reduce2(ProtectedContext context) {}
+                public void reduce3(PublicStaticContext context) {}
+                public void reduce4(ProtectedStaticContext context) {}
+                
+                public void reduce5(PublicBaseContext context) {}
+                public void reduce6(ProtectedBaseContext context) {}
+                public void reduce7(PublicStaticBaseContext context) {}
+                public void reduce8(ProtectedStaticBaseContext context) {}
+                
                 public boolean isDynamic(Type type) {
                     return Type.DYNAMIC == type
                 }
@@ -32,6 +40,14 @@ class Groovy8531Bug extends GroovyTestCase {
             
             new Example().reduce(null)
             new Example().reduce2(null)
+            new Example().reduce3(null)
+            new Example().reduce4(null)
+            
+            new Example().reduce5(null)
+            new Example().reduce6(null)
+            new Example().reduce7(null)
+            new Example().reduce8(null)
+            
             assert new Example().isDynamic(Reducer.Type.DYNAMIC)
         '''
     }
@@ -43,6 +59,16 @@ class Groovy8531Bug extends GroovyTestCase {
                 public void reduce3(PrivateContext context) {}
             }
         '''
-        assert errMsg.contains('unable to resolve class')
+        assert errMsg.contains('unable to resolve class PrivateContext')
+    }
+
+    void testPrivateInnerType2() {
+        def errMsg = shouldFail '''
+            package groovy.bugs.groovy8531
+            class Example extends Reducer {
+                public void reduce3(PrivateBaseContext context) {}
+            }
+        '''
+        assert errMsg.contains('unable to resolve class PrivateBaseContext')
     }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/e51be18e/src/test/groovy/bugs/groovy8531/Reducer.java
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/groovy8531/Reducer.java 
b/src/test/groovy/bugs/groovy8531/Reducer.java
index 95b5b24..6cf865f 100644
--- a/src/test/groovy/bugs/groovy8531/Reducer.java
+++ b/src/test/groovy/bugs/groovy8531/Reducer.java
@@ -18,9 +18,19 @@
  */
 package groovy.bugs.groovy8531;
 
-public class Reducer {
+class BaseReducer {
+    public abstract class PublicBaseContext {}
+    protected abstract class ProtectedBaseContext {}
+    public static abstract class PublicStaticBaseContext {}
+    protected static abstract class ProtectedStaticBaseContext {}
+    private abstract class PrivateBaseContext {}
+}
+
+public class Reducer extends BaseReducer {
     public abstract class PublicContext {}
     protected abstract class ProtectedContext {}
+    public static abstract class PublicStaticContext {}
+    protected static abstract class ProtectedStaticContext {}
     private abstract class PrivateContext {}
 
     public enum Type {

Reply via email to