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

Expect_test_collector.set being re-run and causing error... #12

Open
progman1 opened this issue Feb 26, 2021 · 1 comment
Open

Expect_test_collector.set being re-run and causing error... #12

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

Comments

@progman1
Copy link

I get this error initialisation error:

Expect_test_collector.set: already set

after dynlinking this code:

let ()= 
  let module M =  (val Major_mode.define_derived_mode ~parent:Major_mode.Fundamental.major_mode
      mode_name
      [%here]
      ~docstring:"Major mode for interacting with my thingy"
      ~mode_line:"MYMODE"
      ())
  in
  let keymap=Major_mode.keymap M.major_mode in
  Keymap.define_key keymap (Key_sequence.create_exn "<f5>")
    (Command (Command.of_value_exn(Value.intern "grabbit")))

As I'm compiling a cma to be dynlinked against the ecaml library and so not re-initialising any ecaml modules, there must be something about the code above that causes
Expect_test_collector.set to be called again.
But why should this module be linked in at all? I have no expect tests.
If it's linking is unavoidable, is there something that can be done to prevent the above call being made?
Thanks.

@ghost
Copy link

ghost commented Feb 26, 2021

The call to Expect_test_collector.set is inserted systematically when you use ppx_expect. If you don't have expect test in your file and don't want this code to be inserted, you can remove ppx_expect from the set of preprocessors for this file.

If you use something such as ppx_jane, you can explicitly tell it to not apply ppx_expect by passing the argument -dont-apply expect_test

@github-iron github-iron added the forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system. label Mar 1, 2021
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