unittest_io.scala
来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 25 行
SCALA
25 行
import scala.testing.SUnit._import scala.io.Sourceobject Test extends TestConsoleMain { def suite = new TestSuite( new ReadlinesTest ) class ReadlinesTest extends TestCase("scala.io.Source method getLines") { val src = Source.fromString(""" This is a fileit is split on several lines.isn't it?""") def runTest() = assertEquals("wrong number of lines",src.getLines.toList.length,5) // five new lines in there //for(val line <- src.getLines) { // Console.print(line) //} }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?