Skip to content

Commit 6f1708d

Browse files
committed
test: add ignored test cases for pronom file classification failures
1 parent 2adbb13 commit 6f1708d

File tree

1 file changed

+53
-7
lines changed

1 file changed

+53
-7
lines changed

file_type/tests/classify_pronom_files.rs

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,52 @@ use std::path::PathBuf;
44
use walkdir::WalkDir;
55

66
const CRATE_DIR: &str = env!("CARGO_MANIFEST_DIR");
7+
const IGNORED: [&str; 44] = [
8+
"fmt/161",
9+
"fmt/276",
10+
"fmt/301",
11+
"fmt/302",
12+
"fmt/433",
13+
"fmt/435",
14+
"fmt/532",
15+
"fmt/558",
16+
"fmt/62",
17+
"fmt/63",
18+
"fmt/64",
19+
"fmt/65",
20+
"fmt/66",
21+
"fmt/67",
22+
"fmt/68",
23+
"fmt/69",
24+
"fmt/70",
25+
"fmt/71",
26+
"fmt/72",
27+
"fmt/73",
28+
"fmt/74",
29+
"fmt/75",
30+
"fmt/76",
31+
"fmt/77",
32+
"fmt/78",
33+
"fmt/79",
34+
"fmt/96",
35+
"fmt/950",
36+
"fmt/1062",
37+
"fmt/1105",
38+
"fmt/1157",
39+
"fmt/1389",
40+
"fmt/1451",
41+
"fmt/1739",
42+
"fmt/1757",
43+
"fmt/1796",
44+
"fmt/1854",
45+
"fmt/1871",
46+
"fmt/2008",
47+
"fmt/2009",
48+
"x-fmt/91",
49+
"x-fmt/142",
50+
"x-fmt/178",
51+
"x-fmt/280",
52+
];
753

854
fn data_dir() -> PathBuf {
955
PathBuf::from(CRATE_DIR)
@@ -37,7 +83,7 @@ async fn test_file(file_name: &str) -> Result<(String, &FileType)> {
3783
async fn test_file_classification() -> Result<()> {
3884
let data_dir = data_dir();
3985
let mut passed_tests = 0;
40-
let mut failed_tests = 0;
86+
let mut ignored_tests = 0;
4187

4288
for entry in WalkDir::new(data_dir) {
4389
let entry = entry?;
@@ -53,21 +99,21 @@ async fn test_file_classification() -> Result<()> {
5399
.to_string();
54100
let (id, file_type) = test_file(&file_name).await?;
55101

56-
if file_type.id() == id {
57-
assert_eq!(file_type.id(), id);
58-
passed_tests += 1;
59-
} else {
102+
if IGNORED.contains(&id.as_str()) {
60103
eprintln!(
61104
"[ERROR] file_type.id()={}, id={}: {file_name}",
62105
file_type.id(),
63106
id
64107
);
65-
failed_tests += 1;
108+
ignored_tests += 1;
109+
continue;
66110
}
111+
assert_eq!(file_type.id(), id);
112+
passed_tests += 1;
67113
}
68114

69115
println!("Passed: {passed_tests}");
70-
println!("Failed: {failed_tests}");
116+
println!("Ignored: {ignored_tests}");
71117
Ok(())
72118
}
73119

0 commit comments

Comments
 (0)