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

Crash upon let%expect_test right before EOF with no newline #27

Open
aantron opened this issue Mar 8, 2021 · 1 comment
Open

Crash upon let%expect_test right before EOF with no newline #27

aantron opened this issue Mar 8, 2021 · 1 comment
Labels
forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.

Comments

@aantron
Copy link

aantron commented Mar 8, 2021

With test.ml:

let%expect_test _ = print_endline "foo"

dune:

(library
 (name test)
 (inline_tests)
 (preprocess (pps ppx_expect)))

and ppx_expect 1.14.1, I get

inline_test_runner_test alias pkg/ppx-expect-bug/runtest (exit 2)
(cd _build/default/pkg/ppx-expect-bug && .test.inline-tests/inline_test_runner_test.exe inline-test-runner test -source-tree-root ../.. -diff-cmd -)
Fatal error: exception ("Expect test evaluator bug" (exn (Invalid_argument "index out of bounds"))
  (backtrace
     "Raised at Base__Exn.protectx in file \"src/exn.ml\", line 71, characters 4-114\
    \nCalled from Ppx_expect_evaluator.process_group.write_corrected in file \"evaluator/ppx_expect_evaluator.ml\" (inlined), line 181, characters 6-88\
    \nCalled from Ppx_expect_evaluator.process_group in file \"evaluator/ppx_expect_evaluator.ml\", line 191, characters 10-45\
    \nCalled from Ppx_expect_evaluator.evaluate_tests.(fun) in file \"evaluator/ppx_expect_evaluator.ml\", line 218, characters 6-83\
    \n")
  (filename pkg/ppx-expect-bug/test.ml))
Raised at Base__Error.raise in file "src/error.ml" (inlined), line 8, characters 14-30
Called from Base__Error.raise_s in file "src/error.ml", line 9, characters 19-40
Called from Base__List.count_map in file "src/list.ml", line 387, characters 13-17
Called from Base__List.map in file "src/list.ml" (inlined), line 418, characters 15-31
Called from Ppx_expect_evaluator.evaluate_tests in file "evaluator/ppx_expect_evaluator.ml" (inlined), line 216, characters 5-486
Called from Ppx_expect_evaluator.evaluate_tests in file "evaluator/ppx_expect_evaluator.ml", line 215, characters 2-572
Called from Stdlib__list.map in file "list.ml", line 92, characters 20-23
Called from Stdlib__list.map in file "list.ml", line 92, characters 32-39
Called from Ppx_inline_test_lib__Runtime.exit in file "runtime-lib/runtime.ml", line 615, characters 2-49
Called from Dune__exe__Inline_test_runner_test in file "pkg/ppx-expect-bug/.test.inline-tests/inline_test_runner_test.ml-gen", line 1, characters 9-44

Note that there is no newline in test.ml. ppx_expect works fine if I add the newline.

I didn't try with ppx_expect master because the metadata appears to require ppxlib < 0.18.0.

@github-iron github-iron added the forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system. label Mar 8, 2021
@ghost
Copy link

ghost commented Mar 18, 2021

Thanks for the report. We should indeed fix this.

I didn't try with ppx_expect master because the metadata appears to require ppxlib < 0.18.0.

We recentely updated our internal copy of ppxlib, so this should be fixed by the next push to github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.
Projects
None yet
Development

No branches or pull requests

2 participants