diff options
Diffstat (limited to 'test/files/jvm5')
-rw-r--r-- | test/files/jvm5/stringbuilder.scala | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/test/files/jvm5/stringbuilder.scala b/test/files/jvm5/stringbuilder.scala index c39a5d7600..d0485fcedc 100644 --- a/test/files/jvm5/stringbuilder.scala +++ b/test/files/jvm5/stringbuilder.scala @@ -47,8 +47,14 @@ object Test2 extends TestCase("append") with Assert { val j0 = new java.lang.StringBuilder("abc") // Java 1.5+ val s0 = new StringBuilder("abc") - val j1 = j0 append true append 'a' append 9 append -1L append 1.2e-10f append -2.1e+100d - val s1 = s0 append true append 'a' append 9 append -1L append 1.2e-10f append -2.1e+100d + j0 append true append 'a' append 9 append -1L append 1.2e-10f append -2.1e+100d + s0 append true append 'a' append 9 append -1L append 1.2e-10f append -2.1e+100d + assertEquals("s0.toString equals j0.toString", true, s0.toString equals j0.toString) + + val j1 = new java.lang.StringBuilder // Java 1.5+ + val s1 = new StringBuilder + j1 append "###" append Array('0', '1', '2') append "xyz".subSequence(0, 3) + s1 append "###" append Array('0', '1', '2') append List('x', 'y', 'z') assertEquals("s1.toString equals j1.toString", true, s1.toString equals j1.toString) } } @@ -59,10 +65,18 @@ object Test3 extends TestCase("insert") with Assert { val j0 = new java.lang.StringBuilder("abc") // Java 1.5+ val s0 = new StringBuilder("abc") - val j1 = j0 insert (0, true) insert (0, 'a') insert (0, 9) insert (0, -1L) - val s1 = s0 insert (0, true) insert (0, 'a') insert (0, 9) insert (0, -1L) + j0 insert (0, true) insert (0, 'a') insert (0, 9) insert (0, -1L) + s0 insert (0, true) insert (0, 'a') insert (0, 9) insert (0, -1L) + //println("j0="+j0+", s0="+s0)//debug + assertEquals("s0.toString equals j0.toString", true, s0.toString equals j0.toString) + + val j1 = new java.lang.StringBuilder // Java 1.5+ + val s1 = new StringBuilder + j1 insert (0, "###") insert (0, Array('0', '1', '2')) insert (0, "xyz".subSequence(0, 3)) + s1 insert (0, "###") insert (0, Array('0', '1', '2')) insert (0, List('x', 'y', 'z')) //println("j1="+j1+", s1="+s1)//debug assertEquals("s1.toString equals j1.toString", true, s1.toString equals j1.toString) + } } |