Scala

From Moo
Jump to: navigation, search

Testing[edit]

Writing a test[edit]

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[edit]

 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