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

Split generic tests into separate package #459

Open
Shimuuar opened this issue Apr 16, 2023 · 5 comments
Open

Split generic tests into separate package #459

Shimuuar opened this issue Apr 16, 2023 · 5 comments

Comments

@Shimuuar
Copy link
Contributor

We have an impressive battery of tests which are generic in vector type. I propose splitting them into separate package to benefit anyone who defines instances for vector type classes (me). It turns out creating nontrivial instance is error prone. I was writing storable vectors with stride (vector elements are every n-th in buffer)

This will entail creating another package vector-test which exposes generic tests and moving vector's test suite there. @lehins @Bodigrim what's you opinion on that?

@Bodigrim
Copy link
Contributor

@lehins
Copy link
Contributor

lehins commented Apr 16, 2023

The idea with quickcheck-classes would be problematic:

  • The package includes tests for laws, where generic test contains all sorts of good reusable tests that aren't related to any laws. This is mostly conceptional problem and might be not that big of a deal.
  • quickcheck-classes depends on vector, so if we move reusable tests into that package, vector itself cannot use it, unless we separate vector tests into its own package. So, we aren't really winning much, still has to create a vector-test package.

I would suggest to create a public sublibrary with reusable tests directly in vector. That comes with nice benefits of having all tests stuff still in vector without a need to start releasing a new package. The downside we'd have to drop support for building cabal < 3.0. As far I've heard hackage has support for sublibraries nowadays, but I haven't confirmed it personally.

Either way, I do see it as a good idea to to expose all the test functionality that could be useful to the outside world and making it reusable through a library, be it standalone or sublibrary.

@Shimuuar
Copy link
Contributor Author

One benefit of vector's test suite is that it's rather comprehensive. So one could hope that does exercise all relevant properties. It's also more likely to be correct. For example quickcheck-classes do not test tricky part of move. Namely overlapping source/destination.

I like idea of using public sublibrary. It however may break some of existing tooling. Quick search brings up: NixOS/cabal2nix#448 NixOS/cabal2nix#539

@lehins
Copy link
Contributor

lehins commented Apr 17, 2023

It however may break some of existing tooling.

Good. Maybe adding a sublibrary to vector will speed up fixes in those tools. Thus further promoting support for new and useful features 😄

@Bodigrim
Copy link
Contributor

I'd suggest starting with an internal sublibrary first, publishing it and checking how infrastructure copes. Even Stack has (had?) issues with internal sublibraries (see commercialhaskell/stackage#6167) and I suspect that public sublibraries will be an even bigger challenge (see commercialhaskell/stack#5318).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants