Skip to content

Testkit module #33

Open
kubukoz opened this issue Nov 20, 2020 · 2 comments
Open

Testkit module #33

kubukoz opened this issue Nov 20, 2020 · 2 comments

Comments

@kubukoz
Copy link
Contributor

kubukoz commented Nov 20, 2020

Hi! It would be nice to have a testing module that'd let you do something like Circe's codec laws.

I'm building something like this for work, I'll see if I can contribute it back here later.

Things I'd like to see in this kind of thing:

  • def codingTest[A: XmlEncoder: XmlDecoder](value: A, expectedEncoding: String): Unit
  • def roundtripTest[A: Arbitrary: XmlEncoder: XmlDecoder]: Assertion = forAll(...)

It would probably be better to compare the AST instead of strings, though. I suppose currently I can defer to aalto's parser. These would probably help (especially in test land):

  • Must have: function that parses String to a XML AST with an Either in the result
  • Nice to have: XML interpolator (doesn't need to support symbol interpolations in the beginning, just calling the parser at compile-time would be nice)
  • Nice to have: type alias / newtype for the AST type, so that users don't need to find the right import from aalto

Update: I also just realised codingTest would need a way to check equality (in the "value encodes back as expectedEncoding" test) ignoring the missing fields...

@valentiay
Copy link
Contributor

Hi! That would be a great feature, thank you! Ask me, if you have any problems

@kubukoz
Copy link
Contributor Author

kubukoz commented Mar 10, 2021

Just noting I'm not using phobos anymore (my previous team is) so I probably won't have time to implement this :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants