Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add a few tips on converting from match-style assertions #164

Merged
merged 1 commit into from
Jul 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/scalatest.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down