From 7adf2fe9b5ebb520551b1c4d85db2ef7318bcb43 Mon Sep 17 00:00:00 2001 From: Keith Pinson Date: Thu, 16 Jul 2020 11:48:39 -0400 Subject: [PATCH] doc: add a few tips on converting from match-style assertions --- docs/scalatest.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/scalatest.md b/docs/scalatest.md index c570a5f0..00ec1444 100644 --- a/docs/scalatest.md +++ b/docs/scalatest.md @@ -31,6 +31,22 @@ improve the error message in failed assertions: + assertEquals(a, b) ``` +Or if you are using match-style assertions via `with Matchers`, change the +assertions like so: + +```diff +- result shouldEqual Some(Name(first, last)) ++ assertEquals(result, Some(Name(first, last))) +``` + +MUnit doesn't ship with a large set of assertions, so some fancier matchers will +have to be converted to a simple assertion: + +```diff +- myList should have size 2 ++ assertEquals(myList.length, 2) +``` + If you are coming from `WordSpec` style tests, make sure to flatten them, or your tests will not run. (Only the outer test will be selected to run, and the inner tests will do nothing).