You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2022/01/22 04:14:06 UTC

[groovy] branch master updated: GROOVY-10434: ClassNode isSealed() refactoring (additional test)

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

paulk 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 bcfd3ba  GROOVY-10434: ClassNode isSealed() refactoring (additional test)
bcfd3ba is described below

commit bcfd3ba2dda92b52c634d6aad29da379767961ff
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Jan 22 14:13:59 2022 +1000

    GROOVY-10434: ClassNode isSealed() refactoring (additional test)
---
 .../codehaus/groovy/transform/SealedTransformTest.groovy  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/test/org/codehaus/groovy/transform/SealedTransformTest.groovy b/src/test/org/codehaus/groovy/transform/SealedTransformTest.groovy
index 7e23073..939c155 100644
--- a/src/test/org/codehaus/groovy/transform/SealedTransformTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/SealedTransformTest.groovy
@@ -233,4 +233,19 @@ class SealedTransformTest {
             sealed class Other permits Other { }
         ''').message.contains(expected)
     }
+
+    @Test
+    void testClassNodeIsSealed() {
+        assertScript '''
+            import groovy.transform.*
+            import org.codehaus.groovy.control.CompilePhase
+            @ASTTest(phase = CompilePhase.SEMANTIC_ANALYSIS, value = {
+                assert node.permittedSubclasses*.name == ['Bar']
+                assert node.isSealed()
+            })
+            sealed class Foo permits Bar {}
+            final class Bar {}
+            new Foo()
+        '''
+    }
 }