Skip to content
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

Add Reason flags --re-intf and --re-impl #74

Open
jchavarri opened this issue May 26, 2019 · 5 comments
Open

Add Reason flags --re-intf and --re-impl #74

jchavarri opened this issue May 26, 2019 · 5 comments

Comments

@jchavarri
Copy link

jchavarri commented May 26, 2019

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})))
@hhugo
Copy link
Contributor

hhugo commented May 26, 2019

Wouldn't that create circle deps between omp and reason?

@jchavarri
Copy link
Author

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?

@hhugo
Copy link
Contributor

hhugo commented May 27, 2019

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.

@ghost
Copy link

ghost commented May 30, 2019

@jchavarri could you describe your test framework? I'm wondering if it could be an inline test backend.

@jchavarri
Copy link
Author

@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?

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

No branches or pull requests

2 participants