envie/testing

Values

pub fn isolated(test_fn: fn() -> a) -> a

Run test_fn with an empty environment; original env is restored afterwards.

pub fn with_dotenv_content(
  content: String,
  test_fn: fn() -> a,
) -> a

Parse content as .env, set the variables for test_fn, then restore the env.

pub fn with_env(
  vars: List(#(String, String)),
  test_fn: fn() -> a,
) -> a

Run test_fn with the given environment variables set. Previous values are saved and restored afterwards (panic-safe).

Search Document