groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emil...@apache.org
Subject [groovy] branch master updated: GROOVY-9344: add test case
Date Fri, 10 Jan 2020 16:11:25 GMT
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 01d9be5  GROOVY-9344: add test case
01d9be5 is described below

commit 01d9be5205abb005601a969bd464a5abcb77ba0d
Author: Eric Milles <eric.milles@thomsonreuters.com>
AuthorDate: Fri Jan 10 10:11:17 2020 -0600

    GROOVY-9344: add test case
---
 .../asm/sc/StaticCompileFlowTypingTest.groovy      | 37 +++++++++++++++++++---
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompileFlowTypingTest.groovy
b/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompileFlowTypingTest.groovy
index 81894f2..696164d 100644
--- a/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompileFlowTypingTest.groovy
+++ b/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompileFlowTypingTest.groovy
@@ -18,10 +18,17 @@
  */
 package org.codehaus.groovy.classgen.asm.sc
 
-import org.codehaus.groovy.classgen.asm.AbstractBytecodeTestCase
+import groovy.test.NotYetImplemented
+import groovy.transform.CompileStatic
+import org.junit.Test
 
-class StaticCompileFlowTypingTest extends AbstractBytecodeTestCase {
-    void testFlowTyping() {
+import static groovy.test.GroovyAssert.assertScript
+
+@CompileStatic
+final class StaticCompileFlowTypingTest {
+
+    @Test
+    void testFlowTyping1() {
         assertScript '''
             @groovy.transform.CompileStatic
             Object m() {
@@ -36,6 +43,27 @@ class StaticCompileFlowTypingTest extends AbstractBytecodeTestCase {
         '''
     }
 
+    @NotYetImplemented @Test // GROOVY-9344
+    void testFlowTyping2() {
+        assertScript '''
+            class A {}
+            class B {}
+
+            @groovy.transform.CompileStatic
+            String m() {
+                def var
+                var = new A()
+                def c = { ->
+                    var = new B()
+                }
+                c()
+                var.toString()
+            }
+            assert m() != null
+        '''
+    }
+
+    @Test
     void testInstanceOf() {
         assertScript '''
             @groovy.transform.CompileStatic
@@ -50,6 +78,7 @@ class StaticCompileFlowTypingTest extends AbstractBytecodeTestCase {
         '''
     }
 
+    @Test
     void testMethodSelection() {
         assertScript '''
             @groovy.transform.CompileStatic
@@ -63,6 +92,7 @@ class StaticCompileFlowTypingTest extends AbstractBytecodeTestCase {
         '''
     }
 
+    @Test
     void testMethodSelectionDifferentFromDynamicGroovy() {
         assertScript '''
             @groovy.transform.CompileStatic
@@ -90,7 +120,6 @@ class StaticCompileFlowTypingTest extends AbstractBytecodeTestCase {
             assert a.foo(arr[0]) == 1
             assert a.foo(arr[1]) == 2
             assert a.foo(arr[2]) == 3
-
         '''
     }
 }


Mime
View raw message