(case: &CssMinifyTestCase)
| 67 | } |
| 68 | |
| 69 | fn test_case(case: &CssMinifyTestCase) -> TestResult { |
| 70 | let source = case.source_text.clone(); |
| 71 | match catch_unwind(move || minify(&source)) { |
| 72 | Err(e) => { |
| 73 | let msg = if let Some(s) = e.downcast_ref::<&str>() { |
| 74 | s.to_string() |
| 75 | } else if let Some(s) = e.downcast_ref::<String>() { |
| 76 | s.clone() |
| 77 | } else { |
| 78 | "unknown panic".to_string() |
| 79 | }; |
| 80 | TestResult::Panic(msg) |
| 81 | } |
| 82 | Ok(actual) => { |
| 83 | if actual == case.expected { |
| 84 | return TestResult::Pass; |
| 85 | } |
| 86 | TestResult::Fail(actual) |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | fn format_diff(actual: &str, expected: &str) -> String { |
| 92 | let mut out = String::new(); |
no test coverage detected