Scala: Difference between revisions
Jump to navigation
Jump to search
(Created page with "=Testing= ==Writing a test== <pre> import org.scalatest.{FlatSpec, Matchers} class StreamSpec extends FlatSpec with Matchers { "Stream.toList" should "convert the steam to...") |
(No difference)
|
Latest revision as of 21:36, 14 September 2021
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