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/10/12 18:49:23 UTC

[groovy] 02/02: GROOVY-9927: add test case

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

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

commit ce11c8c51ae31cc77d2d986d61a447fab0eefd6f
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Tue Oct 12 13:40:14 2021 -0500

    GROOVY-9927: add test case
---
 .../groovy/tools/stubgenerator/Groovy9927.groovy   | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy9927.groovy b/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy9927.groovy
new file mode 100644
index 0000000..eef6d6b
--- /dev/null
+++ b/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy9927.groovy
@@ -0,0 +1,58 @@
+/*
+ *  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.stubgenerator
+
+final class Groovy9927 extends StringSourcesStubTestCase {
+
+    @Override
+    Map<String, String> provideSources() {
+        [
+            'model/Outer.groovy': '''
+                package model
+                class Logger {
+                    enum Level {
+                        INFO, WARN, ERROR
+                    }
+                }
+            ''',
+            'other/Thing.groovy': '''
+                package other
+                import model.Logger
+                class Thing {
+                    String describe(Logger.Level level) {
+                        return level.name()
+                    }
+                }
+            ''',
+            'Main.java': '''
+                public class Main {
+                    public static void main(String[] args) {
+                        new other.Thing();
+                    }
+                }
+            ''',
+        ]
+    }
+
+    @Override
+    void verifyStubs() {
+        String stub = stubJavaSourceFor('other.Thing')
+        assert stub.contains('java.lang.String describe(model.Logger.Level ')
+    }
+}