From 2eef66a2ed9b02962511e38c620efb23e2d65b00 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 15 Jun 2021 22:38:21 +0300 Subject: internal: sanity-check minicore flags --- crates/test_utils/src/fixture.rs | 9 +++++++++ crates/test_utils/src/minicore.rs | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'crates') diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index 535892f3f..779146084 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs @@ -276,6 +276,7 @@ impl MiniCore { } let mut curr_region = ""; + let mut seen_regions = Vec::new(); for line in lines { let trimmed = line.trim(); if let Some(region) = trimmed.strip_prefix("// region:") { @@ -288,6 +289,7 @@ impl MiniCore { curr_region = ""; continue; } + seen_regions.push(curr_region); let mut flag = curr_region; if let Some(idx) = trimmed.find("// :") { @@ -305,6 +307,13 @@ impl MiniCore { buf.push_str(line) } } + + for flag in &self.valid_flags { + if !seen_regions.iter().any(|it| it == flag) { + panic!("unused minicore flag: {:?}", flag); + } + } + buf } } diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index f9f14b7df..8c0d122dc 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs @@ -64,7 +64,7 @@ pub mod ops { pub use self::deref::Deref; // endregion:deref - //region:range + // region:range mod range { #[lang = "RangeFull"] pub struct RangeFull; @@ -99,7 +99,7 @@ pub mod ops { } pub use self::range::{Range, RangeFrom, RangeFull, RangeTo}; pub use self::range::{RangeInclusive, RangeToInclusive}; - //endregion:range + // endregion:range } // region:slice -- cgit v1.2.3