diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-07-24 13:01:08 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-07-24 13:01:08 +0000 |
| commit | b481c5b8ba322612fb3bc167e323f7a548a2390c (patch) | |
| tree | 834f0cad95c61f1e0defb9b19683c68b35f8e42d | |
| parent | c5d7021cddd97a4ec8dd64f878711ec983986fcd (diff) | |
std_detect testing improvements
* Fix riscv testing. Previously the mod tests; would be looking for src/detect/os/tests.rs. * Replace a test with an unnamed const item. It is testing that no warnings are emitted. It doesn't contain any checks that need to run at runtime. Replacing the test allows removing the tidy:skip directive for test locations.
| -rw-r--r-- | library/std_detect/src/detect/macros.rs | 5 | ||||
| -rw-r--r-- | library/std_detect/src/detect/os/riscv.rs | 1 | ||||
| -rw-r--r-- | src/tools/tidy/src/unit_tests.rs | 3 |
3 files changed, 4 insertions, 5 deletions
diff --git a/library/std_detect/src/detect/macros.rs b/library/std_detect/src/detect/macros.rs index c2a006d3753..17140e15653 100644 --- a/library/std_detect/src/detect/macros.rs +++ b/library/std_detect/src/detect/macros.rs @@ -131,14 +131,13 @@ macro_rules! features { }; } - #[test] //tidy:skip #[deny(unexpected_cfgs)] #[deny(unfulfilled_lint_expectations)] - fn unexpected_cfgs() { + const _: () = { $( check_cfg_feature!($feature, $feature_lit $(, without cfg check: $feature_cfg_check)? $(: $($target_feature_lit),*)?); )* - } + }; /// Each variant denotes a position in a bitset for a particular feature. /// diff --git a/library/std_detect/src/detect/os/riscv.rs b/library/std_detect/src/detect/os/riscv.rs index 46b7dd71eb3..dc9a4036d86 100644 --- a/library/std_detect/src/detect/os/riscv.rs +++ b/library/std_detect/src/detect/os/riscv.rs @@ -135,4 +135,5 @@ pub(crate) fn imply_features(mut value: cache::Initializer) -> cache::Initialize } #[cfg(test)] +#[path = "riscv/tests.rs"] mod tests; diff --git a/src/tools/tidy/src/unit_tests.rs b/src/tools/tidy/src/unit_tests.rs index 90da1bc765a..3d14a467319 100644 --- a/src/tools/tidy/src/unit_tests.rs +++ b/src/tools/tidy/src/unit_tests.rs @@ -79,8 +79,7 @@ pub fn check(root_path: &Path, stdlib: bool, bad: &mut bool) { let line = line.trim(); let is_test = || line.contains("#[test]") && !line.contains("`#[test]"); let is_bench = || line.contains("#[bench]") && !line.contains("`#[bench]"); - let manual_skip = line.contains("//tidy:skip"); - if !line.starts_with("//") && (is_test() || is_bench()) && !manual_skip { + if !line.starts_with("//") && (is_test() || is_bench()) { let explanation = if stdlib { format!( "`{package}` unit tests and benchmarks must be placed into `{package}tests`" |
