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/05/27 17:20:45 UTC

[groovy] branch master updated: GROOVY-5204: 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 2c6c2e3  GROOVY-5204: add test case
2c6c2e3 is described below

commit 2c6c2e37709a5422674385134f9fc4d6bedf24a1
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Thu May 27 12:20:32 2021 -0500

    GROOVY-5204: add test case
---
 .../groovy/transform/DelegateTransformTest.groovy    | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/test/org/codehaus/groovy/transform/DelegateTransformTest.groovy b/src/test/org/codehaus/groovy/transform/DelegateTransformTest.groovy
index 7f2eafa..7177ee7 100644
--- a/src/test/org/codehaus/groovy/transform/DelegateTransformTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/DelegateTransformTest.groovy
@@ -1020,6 +1020,26 @@ final class DelegateTransformTest {
             parentDir.deleteDir()
         }
     }
+
+    @Test // GROOVY-5204
+    void testParameterWithDefaultArgument6() {
+        assertScript '''
+            class C {
+                def m(p = null) {
+                    'C'
+                }
+            }
+            class D {
+                @Delegate private C c = new C()
+                def m() {
+                    'D'
+                }
+            }
+
+            assert new D().m() == 'D'
+            assert new D().m('') == 'C'
+        '''
+    }
 }
 
 //------------------------------------------------------------------------------