Skip to content

Commit

Permalink
Fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-braun committed Dec 1, 2024
1 parent 57c31b8 commit ff470a0
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,13 @@ mod tests {
let env_key_1 = &GENERATOR.next();
let env_key_2 = &GENERATOR.next();

crate::with_vars([(env_key_1, Some(env_key_1)), (env_key_2, Some(env_key_2))], || {
assert_eq!(env::var(env_key_1), Ok(env_key_1.to_string()));
assert_eq!(env::var(env_key_2), Ok(env_key_2.to_string()));
});
crate::with_vars(
[(env_key_1, Some(env_key_1)), (env_key_2, Some(env_key_2))],
|| {
assert_eq!(env::var(env_key_1), Ok(env_key_1.to_string()));
assert_eq!(env::var(env_key_2), Ok(env_key_2.to_string()));
},
);

assert_eq!(env::var(env_key_1), Err(VarError::NotPresent));
assert_eq!(env::var(env_key_2), Err(VarError::NotPresent));
Expand All @@ -337,11 +340,14 @@ mod tests {
let env_key_1 = &GENERATOR.next();
let env_key_2 = &GENERATOR.next();

let r = crate::with_vars([(env_key_1, Some(env_key_1)), (env_key_2, Some(env_key_2))], || {
let one_is_set = env::var(env_key_1);
let two_is_set = env::var(env_key_2);
(one_is_set, two_is_set)
});
let r = crate::with_vars(
[(env_key_1, Some(env_key_1)), (env_key_2, Some(env_key_2))],
|| {
let one_is_set = env::var(env_key_1);
let two_is_set = env::var(env_key_2);
(one_is_set, two_is_set)
},
);

let (one_from_closure, two_from_closure) = r;

Expand Down Expand Up @@ -518,11 +524,14 @@ mod tests {
let env_key_1 = &GENERATOR.next();
let env_key_2 = &GENERATOR.next();

let r = crate::async_with_vars([(env_key_1, Some(env_key_1)), (env_key_2, Some(env_key_2))], async {
let one_is_set = env::var(env_key_1).unwrap();
let two_is_set = env::var(env_key_2).unwrap();
(one_is_set, two_is_set)
})
let r = crate::async_with_vars(
[(env_key_1, Some(env_key_1)), (env_key_2, Some(env_key_2))],
async {
let one_is_set = env::var(env_key_1).unwrap();
let two_is_set = env::var(env_key_2).unwrap();
(one_is_set, two_is_set)
},
)
.await;

let (one_from_closure, two_from_closure) = r;
Expand Down

0 comments on commit ff470a0

Please sign in to comment.