Setup single-process integration testing with a utility module. Designed so multiple tests can be run without the need for separate processes. In practice, this means new tests will not need a new file. It allows for easily repeating checks across similar functions e.g. dotenv() and from_filename(".env").
The heart of the utility module is the TestEnv struct which enables controlled setup of a temporary testing environment. When using the test_in_env functions, access to the process' environment is effectively locked using a mutex, reset, and then the TestEnv is created.
Candidate for solution to #58 part one.
Setup single-process integration testing with a utility module. Designed so multiple tests can be run without the need for separate processes. In practice, this means new tests will not need a new file. It allows for easily repeating checks across similar functions e.g.
dotenv()
andfrom_filename(".env")
.The heart of the utility module is the
TestEnv
struct which enables controlled setup of a temporary testing environment. When using thetest_in_env
functions, access to the process' environment is effectively locked using a mutex, reset, and then theTestEnv
is created.Also included:
Example tests using this new system