diff options
author | Paul Phillips <paulp@improving.org> | 2011-08-15 20:48:25 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-08-15 20:48:25 +0000 |
commit | 20859263f2a2cf85464b333b9842bb31c020ee5e (patch) | |
tree | 8a315ae89a7a3bf1093dd4c62dffa7c188c785fc /test/files/run/unittest_io.scala | |
parent | e43daf434becf4497acb4d297ab6d2866c16d1aa (diff) | |
download | scala-20859263f2a2cf85464b333b9842bb31c020ee5e.tar.gz scala-20859263f2a2cf85464b333b9842bb31c020ee5e.tar.bz2 scala-20859263f2a2cf85464b333b9842bb31c020ee5e.zip |
Removing the code which has been deprecated sin...
Removing the code which has been deprecated since 2.8.0. Contributed by
Simon Ochsenreither, although deleting code is such fun one hesitates to
call it a contribution. Still, we will. Closes SI-4860, no review.
Diffstat (limited to 'test/files/run/unittest_io.scala')
-rw-r--r-- | test/files/run/unittest_io.scala | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala index 4d2869ec3b..2cadb9b1df 100644 --- a/test/files/run/unittest_io.scala +++ b/test/files/run/unittest_io.scala @@ -6,20 +6,25 @@ object Test { } object UTF8Tests { - import io.UTF8Codec.encode + def decode(ch: Int) = new String(Array(ch), 0, 1).getBytes("UTF-8") + def run() { - assert(new String( encode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char]))) - assert(new String( encode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char]))) - assert(new String( encode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char]))) - assert(new String(encode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char], + assert(new String( decode(0x004D), "utf8") == new String(Array(0x004D.asInstanceOf[Char]))) + assert(new String( decode(0x0430), "utf8") == new String(Array(0x0430.asInstanceOf[Char]))) + assert(new String( decode(0x4E8C), "utf8") == new String(Array(0x4E8C.asInstanceOf[Char]))) + assert(new String(decode(0x10302), "utf8") == new String(Array(0xD800.asInstanceOf[Char], 0xDF02.asInstanceOf[Char]))) // a client val test = "{\"a\":\"\\u0022\"}" - val Expected = ("a","\"") - assert(scala.util.parsing.json.JSON.parse(test) match { - case Some(List(Expected)) => true - case z => Console.println(z); false - }) + val expected = "a" -> "\"" + + val parsed = scala.util.parsing.json.JSON.parseFull(test) + val result = parsed == Some(Map(expected)) + if(result) + assert(result) + else { + Console.println(parsed); assert(result) + } } } |