What's a good testing architecture / what's the idea behind test packages?

Hey all,

Putting together yet another compiler written in ocaml and it seems about time we grow beyond inline tests. Where do people typically put unit tests and end-to-end tests? I see a lot of separate test repos, is the idea there that those are end to end tests that just import the package from opam and test it at the package boundaries?

Thanks for any advice or tips!

I’m getting to this stage myself, so I’m also wondering, but some conventions I’ve noticed (mostly in the janestreet world) are:

  • putting the tests in a separate Dune library (but inside the same package/directory root) so they test outside the library interface but can still get at libraries that aren’t exposed at the package level;
  • using type level markers (can’t remember the name but there’s a ‘in test only’ wrapper type) to delineate the difference between the testable surface and the stable, end user usable surface. I’m not sure if there’s a convention for modules in the same way, but I’d be interested to know if there is.