about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/tests_outside_test_module.rs
blob: 35126c46af08333edd7c56eac47ef0c2bc5c1f96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//@require-annotations-for-level: WARN
#![allow(unused)]
#![warn(clippy::tests_outside_test_module)]

fn main() {
    // test code goes here
}

// Should lint
#[test]
fn my_test() {}
//~^ ERROR: this function marked with #[test] is outside a #[cfg(test)] module
//~| NOTE: move it to a testing module marked with #[cfg(test)]

#[cfg(test)]
mod tests {
    // Should not lint
    #[test]
    fn my_test() {}
}