summaryrefslogtreecommitdiff
path: root/test/files/run/unittest_io.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-05-19 20:06:19 +0000
committerPaul Phillips <paulp@improving.org>2011-05-19 20:06:19 +0000
commit4afa092314487c0095ff9fd5756d05340f6150b0 (patch)
treed3cf421e67192041f78858fe10735505f4891b3c /test/files/run/unittest_io.scala
parent7595671ec3929aa4ac978826521300a900250214 (diff)
downloadscala-4afa092314487c0095ff9fd5756d05340f6150b0.tar.gz
scala-4afa092314487c0095ff9fd5756d05340f6150b0.tar.bz2
scala-4afa092314487c0095ff9fd5756d05340f6150b0.zip
Removes SUnit (long deprecated!) from the stand...
Removes SUnit (long deprecated!) from the standard library. the relatively small number of partest tests in Scala's suite that were still using SUnit now either just use regular asserts, or they print stuff that partest checks with a .check file. Also fixed some bad indentation, removed ancient useless-looking commented-out code, etc. Contributed by Seth Tisue (way to go seth) no review.
Diffstat (limited to 'test/files/run/unittest_io.scala')
-rw-r--r--test/files/run/unittest_io.scala41
1 files changed, 17 insertions, 24 deletions
diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala
index 974dcff5b3..4d2869ec3b 100644
--- a/test/files/run/unittest_io.scala
+++ b/test/files/run/unittest_io.scala
@@ -1,42 +1,35 @@
-import testing.SUnit._
+object Test {
-object Test extends TestConsoleMain {
- def suite = new TestSuite(new UTF8Tests, new SourceTest)
+ def main(args: Array[String]) {
+ UTF8Tests.run()
+ SourceTest.run()
+ }
- class UTF8Tests extends TestCase("UTF8Codec") {
+ object UTF8Tests {
import io.UTF8Codec.encode
-
- def runTest {
- assertEquals(new String( encode(0x004D), "utf8"), new String(Array(0x004D.asInstanceOf[Char])))
- assertEquals(new String( encode(0x0430), "utf8"), new String(Array(0x0430.asInstanceOf[Char])))
- assertEquals(new String( encode(0x4E8C), "utf8"), new String(Array(0x4E8C.asInstanceOf[Char])))
- assertEquals(new String(encode(0x10302), "utf8"), new String(Array(0xD800.asInstanceOf[Char],
- 0xDF02.asInstanceOf[Char])))
-
+ 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],
+ 0xDF02.asInstanceOf[Char])))
// a client
val test = "{\"a\":\"\\u0022\"}"
val Expected = ("a","\"")
- assertTrue(scala.util.parsing.json.JSON.parse(test) match {
+ assert(scala.util.parsing.json.JSON.parse(test) match {
case Some(List(Expected)) => true
case z => Console.println(z); false
})
}
}
- class SourceTest extends TestCase("Source") {
- def runTest {
- val s = "Here is a test string"
+ object SourceTest {
+ def run() {
+ val s = "Here is a test string"
val f = io.Source.fromBytes(s.getBytes("utf-8"))
val b = new collection.mutable.ArrayBuffer[Char]()
f.copyToBuffer(b)
- assertEquals(s, new String(b.toArray))
-
- /* todo: same factories for BufferedSource and Source
- val g = io.BufferedSource.fromBytes(s.getBytes("utf-8"))
- val c = new collection.mutable.ArrayBuffer[Char]()
- g.copyToBuffer(c)
- assertEquals(s, new String(c.toArray))
- */
+ assert(s == new String(b.toArray))
}
}
}