You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/11/14 09:43:27 UTC

[groovy] branch master updated: Add one more test case for `record`

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

sunlan 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 2aa1e56  Add one more test case for `record`
2aa1e56 is described below

commit 2aa1e563eee31f944f069164ae500cbfb5078f54
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Nov 14 17:43:14 2021 +0800

    Add one more test case for `record`
---
 .../groovy/org/codehaus/groovy/classgen/RecordTest.groovy   | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/test/groovy/org/codehaus/groovy/classgen/RecordTest.groovy b/src/test/groovy/org/codehaus/groovy/classgen/RecordTest.groovy
index 8d32123..c464eac 100644
--- a/src/test/groovy/org/codehaus/groovy/classgen/RecordTest.groovy
+++ b/src/test/groovy/org/codehaus/groovy/classgen/RecordTest.groovy
@@ -444,4 +444,17 @@ class RecordTest {
         }
         '''
     }
+
+    @Test
+    void testCustomizedGetter() {
+        assertScript '''
+            record Person(String name) {
+                String name() {
+                    return "name: $name"
+                }
+            }
+            
+            assert 'name: Daniel' == new Person('Daniel').name()
+        '''
+    }
 }