Skip to content

Commit

Permalink
Rename helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
sonro committed Aug 1, 2024
1 parent 3a9f931 commit 16fd9a8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test_util/src/tests/testenv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ mod new_with_env_file {

#[test]
fn env_file_vars_state() {
let testenv = new_test_env_file_testenv();
let testenv = testenv_with_test_env_file();
test_keys_not_set(&testenv);
}

#[test]
fn env_file_exists() {
let testenv = new_test_env_file_testenv();
let testenv = testenv_with_test_env_file();
test_env_files(&testenv);
}

#[test]
fn env_file_loaded_vars_state() {
let testenv = new_test_env_file_testenv();
let testenv = testenv_with_test_env_file();
test_in_env(&testenv, || {
dotenv().expect(DOTENV_EXPECT);
// dotenv() does not override existing var
Expand All @@ -79,7 +79,7 @@ mod new_with_env_file {

#[test]
fn custom_env_file_vars_state() {
let testenv = new_custom_env_file_testenv();
let testenv = testenv_with_custom_env_file();
test_in_env(&testenv, || {
assert_test_keys_unset();
for (key, _) in CUSTOM_VARS {
Expand All @@ -90,13 +90,13 @@ mod new_with_env_file {

#[test]
fn custom_env_file_exists() {
let testenv = new_custom_env_file_testenv();
let testenv = testenv_with_custom_env_file();
test_env_files(&testenv);
}

#[test]
fn custom_env_file_loaded_vars_state() {
let testenv = new_custom_env_file_testenv();
let testenv = testenv_with_custom_env_file();
test_in_env(&testenv, || {
dotenv().expect(DOTENV_EXPECT);
assert_test_keys_unset();
Expand All @@ -106,13 +106,13 @@ mod new_with_env_file {

#[test]
fn empty_env_file_exists() {
let testenv = new_empty_env_file_testenv();
let testenv = testenv_with_empty_env_file();
test_env_files(&testenv);
}

#[test]
fn empty_env_file_loaded_vars_state() {
let testenv = new_empty_env_file_testenv();
let testenv = testenv_with_empty_env_file();
test_in_env(&testenv, || {
dotenv().expect(DOTENV_EXPECT);
assert_test_keys_unset();
Expand All @@ -121,34 +121,34 @@ mod new_with_env_file {

#[test]
fn custom_bom_env_file_exists() {
let testenv = new_custom_bom_env_file_testenv();
let testenv = testenv_with_custom_bom_env_file();
test_env_files(&testenv);
}

#[test]
fn custom_bom_env_file_loaded_vars_state() {
let testenv = new_custom_bom_env_file_testenv();
let testenv = testenv_with_custom_bom_env_file();
test_in_env(&testenv, || {
dotenv().expect(DOTENV_EXPECT);
assert_env_var(TEST_KEY, TEST_VALUE);
});
}

fn new_test_env_file_testenv() -> TestEnv {
fn testenv_with_test_env_file() -> TestEnv {
let env_file = create_test_env_file();
TestEnv::new_with_env_file(env_file)
}

fn new_custom_env_file_testenv() -> TestEnv {
fn testenv_with_custom_env_file() -> TestEnv {
let env_file = create_custom_env_file();
TestEnv::new_with_env_file(env_file)
}

fn new_empty_env_file_testenv() -> TestEnv {
fn testenv_with_empty_env_file() -> TestEnv {
TestEnv::new_with_env_file([])
}

fn new_custom_bom_env_file_testenv() -> TestEnv {
fn testenv_with_custom_bom_env_file() -> TestEnv {
let mut efc = EnvFileContents::new();
let bom = b"\xEF\xBB\xBF";
efc.push_bytes(bom);
Expand Down

0 comments on commit 16fd9a8

Please sign in to comment.