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

Function test_when_rule_true_condition

crates/csskit_ast/src/collector/tests.rs:196–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194
195#[test]
196fn test_when_rule_true_condition() {
197 let bump = Bump::new();
198 let source = r#"
199 style-rule { collect: --rules; }
200 @when (--rules > 1) {
201 level: error;
202 diagnostic: "Too many rules: " --rules;
203 }
204 "#;
205 let css_source = ".a {} .b {} .c {}";
206
207 let (counters, diagnostics) = run(&bump, source, css_source);
208 let a = CsskitAtomSet::get_dyn_set().atom_from_str("rules");
209 assert_eq!(counters.get(&a), Some(&(StatType::Counter, 3)));
210 assert_eq!(diagnostics.len(), 1);
211 assert_eq!(diagnostics[0].message, "Too many rules: 3");
212 assert_eq!(diagnostics[0].severity, ResolvedDiagnosticLevel::Error);
213}
214
215#[test]
216fn test_when_rule_false_condition() {

Callers

nothing calls this directly

Calls 2

atom_from_strMethod · 0.80
runFunction · 0.70

Tested by

no test coverage detected