mirror of
https://github.com/freemkv/libfreemkv.git
synced 2026-10-07 18:13:10 +00:00
test: allow the allow-path modules' #[path] test side files in the key guard
0b146ef7 moved decrypt.rs and sector/decrypting.rs tests into
decrypt_tests.rs, decrypt_spec_guards_tests.rs and sector/decrypting_tests.rs;
they are the same modules' tests, so they share the allow-path.
This commit is contained in:
@@ -31,8 +31,16 @@ fn allowed(rel: &str) -> bool {
|
||||
|| rel.starts_with("src/aacs/")
|
||||
|| rel == "src/decrypt.rs"
|
||||
|| rel == "src/sector/decrypting.rs"
|
||||
|| TEST_SIDE_FILES.contains(&rel)
|
||||
}
|
||||
|
||||
/// The `#[cfg(test)]` side files of the allow-path modules above (`#[path]` tests).
|
||||
const TEST_SIDE_FILES: [&str; 3] = [
|
||||
"src/decrypt_tests.rs",
|
||||
"src/decrypt_spec_guards_tests.rs",
|
||||
"src/sector/decrypting_tests.rs",
|
||||
];
|
||||
|
||||
/// `src` with every comment blanked (newlines kept), and a copy with string and char
|
||||
/// literal contents blanked too; both keep `src`'s char positions.
|
||||
fn lex(src: &str) -> (Vec<char>, Vec<char>) {
|
||||
@@ -250,6 +258,8 @@ fn the_structural_guard_skips_comments_and_keeps_its_allow_path() {
|
||||
"src/aacs/content.rs",
|
||||
"src/decrypt.rs",
|
||||
"src/sector/decrypting.rs",
|
||||
"src/decrypt_tests.rs",
|
||||
"src/sector/decrypting_tests.rs",
|
||||
] {
|
||||
assert!(hits(rel, code).is_empty(), "{rel} is on the allow-path");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user