ocaml-migrate-parsetree
ocaml-migrate-parsetree copied to clipboard
Add Reason flags --re-intf and --re-impl
I'm working on a ppx where the test cases are written in Reason. Right now I have to manually run these test cases through refmt and write .ml files, that I feed to the omp driver with --impl flag.
But I'm curious if it'd be possible to add some new flags to omp for this?
My current Dune rule:
(rule
(targets pp.result)
(deps test.ml)
(action (run ./main.exe --impl %{deps} -o %{targets})))
What would be ideal:
(rule
(targets pp.result)
(deps test.re)
(action (run ./main.exe --re-impl %{deps} -o %{targets})))
Wouldn't that create circle deps between omp and reason?
Right, I hadn't thought about that 😕
Is there a way to pipe the result of refmt, in ast or ml format, to the omp ppx executable?
Note that you can pass both source files and ast files with --impl.
I don't think there is any support for reading stdin at the moment.
@jchavarri could you describe your test framework? I'm wondering if it could be an inline test backend.
@diml I have a basic config that reads an ml file and uses diff from dune to compare the results: https://github.com/jchavarri/rroo/blob/master/ppx/test/dune
It's based on http://rgrinberg.com/posts/extension-points-3-years-later/. I know the setup is a bit dated, but the article helped me get up and running thanks to how specific and accessible it is. :)
It seems inline tests support Reason syntax, is there some place with an example to write inline tests against a ppx?