cryptosense / ppx_factory

OCaml preprocessor to derive factory methods and default values from type definitions
BSD 2-Clause "Simplified" License
14 stars 1 forks source link

Test deriving errors #19

Closed NathanReb closed 5 years ago

NathanReb commented 5 years ago

This adds the boiler plate to test error cases along with a couple example test cases.

I'll add more cases later!

NathanReb commented 5 years ago

The pattern is indeed gonna repeat a lot, I actually just copied it from what I did for ppx_yojson which I copied from what we came up with after dicussing this with @emillon.

I really like this setup and I guess it would be nice to be able to avoid repeating all that boiler plate and polish it a bit.

For instance I copied pp.ml to have the error test cases seperated from the rest in a folder to avoid polluting the main test one. There's also the unnecessary library stanzas that I produce to make sure we will awlays have a .merlin there. The bash action could be replaced by a run? if we contribute it to dune to make this more portable.

The soon to come dune plugins might help extracting all that into a reusable tool/lib/plugin.

It's probably a bit early now but once it has been battle-tested I'd gladly make it available to ppx authors!