MCPcopy Create free account
hub / github.com/csskit/csskit / test_case

Function test_case

crates/csskit_transform/tests/css-minify-tests.rs:69–89  ·  view source on GitHub ↗
(case: &CssMinifyTestCase)

Source from the content-addressed store, hash-verified

67}
68
69fn 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
91fn format_diff(actual: &str, expected: &str) -> String {
92 let mut out = String::new();

Callers 1

full_suiteFunction · 0.70

Calls 2

cloneMethod · 0.80
minifyFunction · 0.70

Tested by

no test coverage detected