groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Add a test for "GROOVY-8212: coerce GString to String when used as Map key"
Date Fri, 11 May 2018 14:44:25 GMT
Repository: groovy
Updated Branches:
  refs/heads/master ad5de10dd -> 5f6689638


Add a test for "GROOVY-8212: coerce GString to String when used as Map key"


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/5f668963
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/5f668963
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/5f668963

Branch: refs/heads/master
Commit: 5f6689638160c44dccbf2b7155d35edff2389979
Parents: ad5de10
Author: danielsun1106 <realbluesun@hotmail.com>
Authored: Fri May 11 22:44:00 2018 +0800
Committer: danielsun1106 <realbluesun@hotmail.com>
Committed: Fri May 11 22:44:00 2018 +0800

----------------------------------------------------------------------
 src/test/groovy/bugs/Groovy8212Bug.groovy | 36 ++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/5f668963/src/test/groovy/bugs/Groovy8212Bug.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/bugs/Groovy8212Bug.groovy b/src/test/groovy/bugs/Groovy8212Bug.groovy
new file mode 100644
index 0000000..e4bc5b6
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy8212Bug.groovy
@@ -0,0 +1,36 @@
+/*
+ *  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 Groovy8212Bug extends GroovyTestCase {
+    void test() {
+        assertScript '''
+        @groovy.transform.CompileStatic
+        class Groovy8212 {
+            def map = ['a x': 1, 'b x': 2]
+            def get(String k) {
+                return map["$k x"]
+            }
+        }
+        
+        assert 1 == new Groovy8212().get('a')
+        assert 2 == new Groovy8212().get('b')
+        '''
+    }
+}


Mime
View raw message