Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.5.2
-
Fix Version/s: 1.5.3
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
The test case at the bottom runs with 1.5.0 and 1.5.1 and fails with 1.5.2.
The failing test with 1.5.2 is testAssignmentWithMap
class AssignmentTest extends GroovyTestCase { final String SOME_METHOD_VALUE = 'someMethodValue' final String TEST_NAME = 'someName' String s Map names void setUp() { names = [:] } void testAssignmentWithString() { assertEquals(SOME_METHOD_VALUE, someMethod()) } void testAssignmentWithMap() { assertEquals(TEST_NAME, addName(TEST_NAME)) } String someMethod() { s = SOME_METHOD_VALUE } String addName(String name) { names[name] = name } }
Failures also occur with arrays and may vary depending on context (whether in closure or not):
class AssignmentTest extends GroovyTestCase {
final String SOME_METHOD_VALUE = 'someMethodValue'
final String TEST_NAME = 'someName'
String s
Map names
void setUp()
{ names = [:] }void testAssignmentWithString()
{ assertEquals(SOME_METHOD_VALUE, someMethod()) }// This fails in 1.5.2
{ assertEquals(TEST_NAME, addName(TEST_NAME)) }void testAssignmentWithMap()
String someMethod()
{ s = SOME_METHOD_VALUE }String addName(String name)
{ names[name] = name }// This fails in 1.0, 1.5.0, 1.5.1, 1.5.2
{ def arr = [*0..4] assert 33 == (arr[2] = 33) }void testArrayAssignment()
// This fails in 1.5.2
{ arr[2] = 55 }void testArrayAssignmentInClosure() {
def arr = [*0..4]
assert 55 ==
.call()
}
void testVarAssignment()
{ def var = 1 assert 77 == ( var = 77) }void testVarAssignmentInClosure() {
{ var = 22 }def var = 1
assert 22 ==
.call()
}
}