dotenvy icon indicating copy to clipboard operation
dotenvy copied to clipboard

Testing infrastructure

Open sonro opened this issue 3 years ago • 1 comments

The current testing infrastructure is lacking. We have many similar functions: dotenv, from_filename, from_path, from_read and their override and iter variants; but only the dotenv function is being tested for expected behaviour (multiline comments, BOM ignoring etc). I believe having these tests on each function is important to avoid future regressions and ensure the stability of the crate.

We could simply add these tests for each function but it would create an unmaintainable mess of the tests folder. Currently, each test must be in its own file (process) to avoid variable collisions (as the tested functions alter the process environment). Moreover, the output from cargo test will get even more unwieldy that it currently is.

I prepose a 2-part solution:

  1. Create a test harness that can run multiple tests in the same process. (DONE #59)
  2. Create a collection of abstracted checks to run against each public function and their variants.

The second part is a bit harder: we want it to be easy to add more checks AND easy to add the checks to a new public function. They should also be easy to change.

sonro avatar Dec 19 '22 14:12 sonro

Sounds good! Thanks for taking this on.

allan2 avatar Dec 20 '22 23:12 allan2