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

Using ppx_expect does not work with reason #2280

Closed
tcoopman opened this Issue Dec 1, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@tcoopman
Copy link

tcoopman commented Dec 1, 2018

I'm trying to use ppx_expect. I transformed this ocaml sample:

let%expect_test _ =
  print_endline "Hello, world!";
  [%expect{|
    Hello, world!!
  |}]

To reason:

let%expect_test "foo" = {
  print_endline("Hello, world!");
  %expect
  {|
    Hello, world!!
  |};
};

Then I don't get any output when I run esy dune runtest. Running the ocaml example does give a failing test:

--- test/example_.ml    2018-12-01 16:34:20.423049283 +0100
+++ test/example_.ml.corrected  2018-12-01 16:37:38.770332016 +0100
@@ -1,5 +1,5 @@
 let%expect_test _ =
   print_endline "Hello, world!!";
   [%expect{|
-    Hello, world!
+    Hello, world!!
   |}]
\ No newline at end of file
@jaredly

This comment has been minimized.

Copy link
Collaborator

jaredly commented Dec 14, 2018

I assume that this is a problem with ppx_expect, not with reason. I imagine that the ppx_expect evaluator only supports .ml source files

@diml

This comment has been minimized.

Copy link

diml commented Dec 15, 2018

Yes, if the extension point syntax is different in reason then ppx_expect would need to be updated to support it. Looking at the example, I guess that extension points in reason don't have [ and ]? Although, it's a bit odd that you see no output at all.

@tcoopman

This comment has been minimized.

Copy link

tcoopman commented Dec 16, 2018

If wanted I could make a repo that shows this problem, but I'm not sure if it's useful, because the only code is the one in the bug.

@diml

This comment has been minimized.

Copy link

diml commented Dec 16, 2018

Hmm, I just tried and the corrected file is generated but is named test.re.ml.corrected rather than test.re.corrected. It's probably the same issue as ocsigen/js_of_ocaml#716 and it should be fixed by ppxlib 0.4.0 that was just released.

@diml

This comment has been minimized.

Copy link

diml commented Dec 16, 2018

I confirm that it works well with ppxlib 0.4.0

@tcoopman

This comment has been minimized.

Copy link

tcoopman commented Dec 17, 2018

Thanks, this indeed fixed it!

@tcoopman tcoopman closed this Dec 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment