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

paulk pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit db9d64432bf5e7d6e180e0248b13c86e21364998
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Jan 13 23:05:25 2024 +1000

    GROOVY-9464: GroovyDoc: List inherited properties (add testcase)
---
 .../groovy/tools/groovydoc/GroovyDocToolTest.java  | 20 +++++++++++++++++++
 .../tools/groovydoc/testfiles/props/Child.groovy   | 23 ++++++++++++++++++++++
 .../groovydoc/testfiles/props/GrandParent.groovy   | 23 ++++++++++++++++++++++
 .../tools/groovydoc/testfiles/props/Parent.groovy  | 23 ++++++++++++++++++++++
 4 files changed, 89 insertions(+)

diff --git 
a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
index 2ba78271cd..da70a1c422 100644
--- 
a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
+++ 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
@@ -776,6 +776,26 @@ public class GroovyDocToolTest extends GroovyTestCase {
         assertEquals("Classes from imported packages should shadow classes 
from default packages", "a/List", extendedClass.group(1));
     }
 
+    public void testInheritedProperties() throws Exception {
+        htmlTool.add(Arrays.asList(
+                
"org/codehaus/groovy/tools/groovydoc/testfiles/props/Child.groovy",
+                
"org/codehaus/groovy/tools/groovydoc/testfiles/props/Parent.groovy",
+                
"org/codehaus/groovy/tools/groovydoc/testfiles/props/GrandParent.groovy"
+        ));
+
+        final MockOutputTool output = new MockOutputTool();
+        htmlTool.renderToOutput(output, MOCK_DIR);
+        final String childDoc = output.getText(MOCK_DIR + 
"/org/codehaus/groovy/tools/groovydoc/testfiles/props/Child.html");
+
+        final Matcher inheritedProperties = 
Pattern.compile("(?s)<span>Inherited properties</span>" +
+            ".*<a 
href='[./]*/org/codehaus/groovy/tools/groovydoc/testfiles/props/Parent.html'>Parent</a>.*<code>(\\w*)</code>"
 +
+            ".*<a 
href='[./]*/org/codehaus/groovy/tools/groovydoc/testfiles/props/GrandParent.html'>GrandParent</a>.*<code>(\\w*)</code>").matcher(childDoc);
+
+        assertTrue("Should find inherited properties", 
inheritedProperties.find());
+        assertEquals("Should find Parent property", "fooP", 
inheritedProperties.group(1));
+        assertEquals("Should find GrandParent property", "fooGP", 
inheritedProperties.group(2));
+    }
+
     public void 
testJavaExtendsImportedClassWithNameWhichExistInDefaultPackages() throws 
Exception {
         // Java interface b.Test imports a.List and extends List.
         // List should be recognized as a.List and not java.util.List
diff --git 
a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/Child.groovy
 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/Child.groovy
new file mode 100644
index 0000000000..134c1094ce
--- /dev/null
+++ 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/Child.groovy
@@ -0,0 +1,23 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.tools.groovydoc.testfiles.props
+
+class Child extends Parent {
+    String fooC
+}
diff --git 
a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/GrandParent.groovy
 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/GrandParent.groovy
new file mode 100644
index 0000000000..d0282112e1
--- /dev/null
+++ 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/GrandParent.groovy
@@ -0,0 +1,23 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.tools.groovydoc.testfiles.props
+
+class GrandParent {
+    String fooGP
+}
diff --git 
a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/Parent.groovy
 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/Parent.groovy
new file mode 100644
index 0000000000..f5f0388aa3
--- /dev/null
+++ 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/props/Parent.groovy
@@ -0,0 +1,23 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.tools.groovydoc.testfiles.props
+
+class Parent extends GrandParent {
+    String fooP
+}

Reply via email to