Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-JSR-4
-
Fix Version/s: 1.0-JSR-6
-
Component/s: groovy-jdk
-
Labels:None
-
Environment:SuSE Linux 8.2, JDK 1.4.2
-
Testcase included:yes
-
Number of attachments :
Description
Testcase bellow throws exception
testArrayEquals(MultiArrayBugTest)junit.framework.AssertionFailedError: expected array: {"A", "B"} value array: {["A", "C"]} expected:<2> but was:<1>.
// ------------------- MultiArrayClass.java -------------------
public class MultiArrayClass {
public String[][] createArray() {
String s[][] = new String[2][2];
s [0][0] = "A";
s [0][1] = "C";
s [1][0] = "C";
s [1][1] = "D";
return s;
}
}
// ----------------- MultiArrayBugTest.groovy -----------------
class MultiArrayBugTest extends GroovyTestCase {
void testArrayEquals() {
def m = new MultiArrayClass()
def r = m.createArray()
assertArrayEquals(['A','B'] as String[], r[0] as String[]);
assertArrayEquals(['C','D'] as String[], r[1] as String[]);
}
}
I assume the second assignment to s should be:
s[0][1] = "B" ;
Running this on CVS as of 2006-02-07 08:57 I got a slightly different error message:
testArrayEquals(MultiArrayBugTest)junit.framework.AssertionFailedError: expected array: {"A", "B"} value array: {"B"} expected:<2> but was:<1>