Scala
Jump to navigation
Jump to search
Testing
Writing a test
import org.scalatest.{FlatSpec, Matchers}
class StreamSpec extends FlatSpec with Matchers {
"Stream.toList" should "convert the steam to a List" in {
Stream(1, 2, 3, 4).toList shouldBe List(1, 2, 3, 4)
}
Running a single test in sbt
test-only ch5.StreamSpec -- -t "test name"
note a spec with "thing" should "perform trick" will have a name "thing should preform trick" - drop the quotes in the middle