1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
fn main() {}
#[cfg(test)]
mod tests {
// hostname exists
#[test_with::file(/etc/hostname)]
fn test_works() {
assert!(true);
}
// nothing file does not exist
#[test_with::file(/etc/nothing)]
#[test]
fn test_ignored() {
panic!("should be ignored")
}
// hostname and hosts exist
#[test_with::file(/etc/hostname, /etc/hosts)]
#[test]
fn test_works_too() {
assert!(true);
}
// nothing file does not exist
#[test_with::file(/etc/hostname, /etc/nothing)]
#[test]
fn test_ignored_too() {
panic!("should be ignored")
}
// etc exists, but not file
#[test_with::file(/etc)]
#[test]
fn test_ignored_for_file() {
panic!("should be ignored")
}
// hostname exists
#[test_with::path(/etc/hostname)]
#[test]
fn test_works_for_file() {
assert!(true);
}
// etc exists
#[test_with::path(/etc)]
#[test]
fn test_works_for_path() {
assert!(true);
}
// nothing does not exist
#[test_with::path(/nothing)]
#[test]
fn test_ignored_for_path() {
panic!("should be ignored")
}
// etc and tmp exist
#[test_with::path(/etc, /tmp)]
#[test]
fn test_works_for_paths_too() {
assert!(true);
}
// nothing does not exist
#[test_with::file(/etc, /nothing)]
#[test]
fn test_ignored_for_paths_too() {
panic!("should be ignored")
}
}
#[test_with::file(/etc/hostname)]
pub mod workable_mod {
#[test]
fn test_works() {
assert!(true);
}
}
#[test_with::file(/etc/nothing)]
pub mod ignore_pub_mod {
#[test]
fn test_ignored() {
panic!("should be ignored")
}
}
#[test_with::file(/etc/nothing)]
mod ignore_private_mod {
#[test]
fn test_ignored() {
panic!("should be ignored")
}
}
#[test_with::file(/etc/nothing)]
#[cfg(test)]
pub mod ignore_pub_test_mod {
#[test]
fn test_ignored() {
panic!("should be ignored")
}
}
#[test_with::file(/etc/nothing)]
#[cfg(test)]
mod ignore_private_test_mod {
#[test]
fn test_ignored() {
panic!("should be ignored")
}
}
|