Attribute Macro test_with::env [−][src]
#[env]Expand description
Run test case when the environment variable is set.
#[cfg(test)]
mod tests {
// PWD environment variable exists
#[test_with::env(PWD)]
fn test_works() {
assert!(true);
}
// NOTHING environment variable does not exist
#[test_with::env(NOTHING)]
fn test_ignored() {
panic!("should be ignored")
}
// NOT_SAYING environment variable does not exist
#[test_with::env(PWD, NOT_SAYING)]
fn test_ignored_too() {
panic!("should be ignored")
}
}