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 1d49c1b29f179f976dfb2a863ba598d1c2526856 Author: Eric Milles <[email protected]> AuthorDate: Sat Jan 29 12:10:02 2022 -0600 GROOVY-5367: add test case --- src/test/groovy/bugs/Groovy5367.groovy | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/test/groovy/bugs/Groovy5367.groovy b/src/test/groovy/bugs/Groovy5367.groovy new file mode 100644 index 0000000..ec05e59 --- /dev/null +++ b/src/test/groovy/bugs/Groovy5367.groovy @@ -0,0 +1,37 @@ +/* + * 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 Groovy5367 { + + @Test + void testBindingAsClosureDelegate() { + assertScript ''' + def binding = new Binding(c: { -> 'y' }) + def x = { -> c.call() } + x.delegate = binding + String result = x(); + assert result == 'y' + ''' + } +}
