-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat(printer): mk printers more easily configurable #640
Conversation
- add `orElse` combinator for `Printer` for composability - add utility constructor for easier instantiation : user will only pass whatever is actually meaningful to them in most cases, ie. the custom logic to stringify the test values - update `Assertion` to allow users to pass their custom `Printer` without overriding `munitPrint`
+ cleanup the test value
copied from [[munit.PrintersSuite]]
Comment taken into account. I also restricted some tests to scala 2.13 like in |
Looks like the tests are passing! Let's see if anyone more familiar with the codebase has time to look at it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the changes make sense; it seems like a reasonable API to add.
I've left some code-style comments inline.
I also think adding some documentation on how to customize the printer would be good. It could be a separate section on the website under Overview
Comments taken into account in the latest commits. Also added section covering the why and how of custom printers in https://scalameta.org/munit/docs/tests.html right under custom timeouts. Please tell me if its clear enough and / or if you would prefer it elsewhere :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you run scalafix
and scalafmt
? Otherwise looks good, unless @gabro sees anything more to fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Any plans to release this change soon ? |
scalameta/munit#640 requires to change the name of the `io.circe.Printer` val.
Hi !
Following this issue I opened #637 and closed right after once I realised I should havve looked around a bit more, I tried my hand at using custom pretty printers to clarify some of my diffs.
Using the answer to this question #480 I got pretty much what a I needed ( comparing scodecs ByteVectors ) but I found the experience a bit confusing and felt some boilerplate could be avoided.
Which leads me to this PR :)
Changes :
orElse
combinator forPrinter
for composabilityAssertion
to allow users to pass their customPrinter
without also overridingmunitPrint