|
Groovy example source code file (ClosureParameterPassingBug.groovy)
The Groovy ClosureParameterPassingBug.groovy source code
package groovy.bugs
import org.codehaus.groovy.classgen.TestSupport
/**
* @author John Wilson
* @version $Revision: 4996 $
*/
class ClosureParameterPassingBug extends TestSupport {
void testBugInMethod() {
def c = { x ->
def y = 123
def c1 = {
println y
println x
println x[0]
}
c1()
}
c([1])
}
void testBug() {
assertScript """
def c = { x ->
def y = 123
def c1 = {
assert x != null , "Could not find a value for x"
assert y == 123 , "Could not find a value for y"
println x[0]
}
c1()
}
c([1])
"""
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy ClosureParameterPassingBug.groovy source code file: |
Other websites by Alvin Alexander:
Life/living in Alaska (OneMansAlaska.com)
How I Sold My Business (HowISoldMyBusiness.com)
Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.