1 //! Tidy check to ensure `#[test]` is not used directly inside `libcore`.
3 //! `#![no_core]` libraries cannot be tested directly due to duplicating lang
4 //! item. All tests must be written externally in `libcore/tests`.
8 pub fn check(path: &Path, bad: &mut bool) {
9 let libcore_path = path.join("libcore");
12 &mut |subpath| t!(subpath.strip_prefix(&libcore_path)).starts_with("tests"),
13 &mut |entry, contents| {
14 let subpath = entry.path();
15 if let Some("rs") = subpath.extension().and_then(|e| e.to_str()) {
16 let contents = contents.trim();
17 if !contents.starts_with("//") && contents.contains("#[test]") {
20 "`{}` contains `#[test]`; libcore tests must be placed inside \
21 `src/libcore/tests/`",