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 2019/01/25 17:10:41 UTC
[groovy] branch master updated: Add a test for "GROOVY-5852: Static
import on demand resolves capitalised reference"
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 ae463cd Add a test for "GROOVY-5852: Static import on demand resolves capitalised reference"
ae463cd is described below
commit ae463cd8e9a488d501d884598a806ee0d10a8b8a
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Jan 26 01:10:13 2019 +0800
Add a test for "GROOVY-5852: Static import on demand resolves capitalised reference"
---
src/test/groovy/bugs/Groovy5852Bug.groovy | 49 +++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/src/test/groovy/bugs/Groovy5852Bug.groovy b/src/test/groovy/bugs/Groovy5852Bug.groovy
new file mode 100644
index 0000000..5b9b83f
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy5852Bug.groovy
@@ -0,0 +1,49 @@
+/*
+ * 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 groovy.bugs
+
+class Groovy5852Bug extends GroovyTestCase {
+ void testMissingProperty() {
+ def errMsg = shouldFail '''
+ class Constants {
+ static final pi = 3.14
+ }
+
+ import static Constants.*
+
+ println Pi
+ '''
+
+ assert errMsg.contains('No such property: Pi for class:')
+ }
+
+ void testMissingProperty2() {
+ def errMsg = shouldFail '''
+ class Constants {
+ static final pi = 3.14
+ }
+
+ import static Constants.*
+
+ println Constants.Pi
+ '''
+
+ assert errMsg.contains('No such property: Pi for class: Constants')
+ }
+}