Skip to content

Testkit module #33

@kubukoz

Description

@kubukoz

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions