diff options
Diffstat (limited to 'test/files/run/unittest_io.scala')
-rw-r--r-- | test/files/run/unittest_io.scala | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala index 183f989df8..53f9b3b87c 100644 --- a/test/files/run/unittest_io.scala +++ b/test/files/run/unittest_io.scala @@ -1,7 +1,7 @@ import testing.SUnit._ object Test extends TestConsoleMain { - def suite = new TestSuite(new UTF8Tests()) + def suite = new TestSuite(new UTF8Tests, new SourceTest) class UTF8Tests extends TestCase("UTF8Codec") { import io.UTF8Codec.encode @@ -22,4 +22,21 @@ object Test extends TestConsoleMain { }) } } + + class SourceTest extends TestCase("Source") { + def runTest { + 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)) + */ + } + } } |