ORoberts
ORoberts

Reputation: 67

Dune runtest resulat in error in lib/dune on (inline_tests) with expect_test

I am learning OCaml, I strugled with installing it and Dune on Windows 10 but it finally ran. I started doing a few exercises, getting the lay of the land and everything was working as intended.

Then I rebooted my computer, and now, when running dune runtest, I get an error if I use the testing tool let%expect_test imported by the module ppx_expect

my lib file (lib/customs/ml):

let rec power a b =
  match b with
  | 0 -> 1
  | 1 -> a
  | _ -> a * (power a (b-1));;


let%expect_test _ =
  print_int (power 2 4);
  [%expect{|
    16
|}]

I get this output:

> opam exec -- dune runtest
File "lib/dune", line 3, characters 1-15:
3 |  (inline_tests)
     ^^^^^^^^^^^^^^
Fatal error: exception ("Expect test evaluator bug" (exn "Assert_failure matcher/cst.ml:461:7")
  (backtrace
     "Raised at Expect_test_matcher__Cst.invariant in file \"matcher/cst.ml\", line 461, characters 7-78\
    \nCalled from Expect_test_matcher__Cst.reconcile in file \"matcher/cst.ml\", line 657, characters 2-22\
    \nCalled from Expect_test_matcher__Reconcile.expectation_body_internal in file \"matcher/reconcile.ml\", line 170, characters 9-150\
    \nCalled from Expect_test_matcher__Reconcile.expectation_body in file \"matcher/reconcile.ml\", line 203, characters 4-131\
    \nCalled from Expect_test_matcher__Matcher.evaluate_test.(fun).correction_for in file \"matcher/matcher.ml\", line 214, characters 10-208\
    \nCalled from Base__List.rev_filter_map.loop in file \"src/list.ml\", line 962, characters 13-17\
    \nCalled from Base__List.filter_map in file \"src/list.ml\" (inlined), line 969, characters 26-47\
    \nCalled from Expect_test_matcher__Matcher.evaluate_test in file \"matcher/matcher.ml\" (inlined), line 210, characters 7-1023\
    \nCalled from Expect_test_matcher__Matcher.evaluate_test in file \"matcher/matcher.ml\", line 209, characters 4-1023\
    \nCalled from Ppx_expect_evaluator.process_group.(fun) in file \"evaluator/ppx_expect_evaluator.ml\", line 154, characters 8-82\
    \nCalled from Base__Map.Accessors.fold in file \"src/map.ml\" (inlined), line 2125, characters 24-50\
    \nCalled from Ppx_expect_evaluator.process_group in file \"evaluator/ppx_expect_evaluator.ml\", line 152, characters 4-228\
    \nCalled from Ppx_expect_evaluator.evaluate_tests.(fun) in file \"evaluator/ppx_expect_evaluator.ml\", line 227, characters 6-149\
    \n")
  (filename lib/customs.ml))
Raised at Base__Error.raise in file "src/error.ml" (inlined), line 9, characters 14-30
Called from Base__Error.raise_s in file "src/error.ml", line 10, characters 19-40
Called from Base__List.count_map in file "src/list.ml", line 479, characters 13-17
Called from Base__List.map in file "src/list.ml" (inlined), line 510, characters 15-31
Called from Ppx_expect_evaluator.evaluate_tests in file "evaluator/ppx_expect_evaluator.ml" (inlined), line 225, characters 5-556
Called from Ppx_expect_evaluator.evaluate_tests in file "evaluator/ppx_expect_evaluator.ml", line 224, characters 2-642
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.exit in file "runtime-lib/ppx_inline_test_lib.ml", line 762, characters 2-49
Called from Dune__exe__Inline_test_runner_customs in file "lib/.customs.inline-tests/inline_test_runner_customs.ml-gen", line 1, characters 9-36
>

Here is my lib/dune:

(library
 (name customs)
 (inline_tests)
 (preprocess (pps ppx_inline_test ppx_expect))
)

I am using VSCode to assis me, creating a sandboxed terminal. I tried uninstalling and reinstalling the ppx_inline_test packages.

I'd take any guidance on the matter. Thank you.

Upvotes: 0

Views: 62

Answers (0)

Related Questions