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 2022/01/30 19:27:30 UTC

[groovy] 02/02: GROOVY-10236: 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 098937b33d4583a25eb5f54fa529ab716a02aa08
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Sep 16 10:30:40 2021 +0800

    GROOVY-10236: add test case
---
 src/test/groovy/bugs/Groovy10236.groovy | 34 +++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/src/test/groovy/bugs/Groovy10236.groovy b/src/test/groovy/bugs/Groovy10236.groovy
new file mode 100644
index 0000000..07ee797
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy10236.groovy
@@ -0,0 +1,34 @@
+/*
+ *  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
+
+import org.junit.Test
+
+import static groovy.test.GroovyAssert.assertScript
+
+final class Groovy10236 {
+    @Test
+    void testOmittingParenthesesInLambdaBody() {
+        assertScript '''
+            def same(obj) { obj }
+            def list = [1,2,3].stream().map(num -> same "$num").toList()
+            assert list == ['1','2','3']
+        '''
+    }
+}