|
Groovy example source code file (Groovy3770Bug.groovy)
The Groovy Groovy3770Bug.groovy source codepackage groovy.bugs class Groovy3770Bug extends GroovyTestCase { void testSetDelegateAndResolveStrategyOnACurriedClosure() { assertScript """ void hello(who) { println ("Hello " + who) } def c = { x -> hello(x) } def d = c.curry("Ian") d.call() d.delegate = null assert d.delegate == null d.resolveStrategy = Closure.DELEGATE_ONLY try { d.call() throw new RuntimeException("The curried closure call should have failed here with MME") } catch(MissingMethodException ex) { // ok if closure call returned in an exception (MME) } """ } void testCurriedClosuresShouldNotAffectParent() { // GROOVY-3875 def orig = { tmp -> println tmp } def curriedOrig = orig.curry(1) assert orig != curriedOrig.getOwner() } } Other Groovy examples (source code examples)Here is a short list of links related to this Groovy Groovy3770Bug.groovy source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.