mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Smoke-test the dependency tracking logic.
MozReview-Commit-ID: J5HWdS1H49s Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
9e33cd5643
commit
a0c2bdf775
4 changed files with 64 additions and 11 deletions
|
@ -1164,7 +1164,7 @@ pub mod tests {
|
|||
impl SelectorMethods for PseudoClass {
|
||||
type Impl = DummySelectorImpl;
|
||||
|
||||
fn visit<V>(&self, visitor: &mut V) -> bool
|
||||
fn visit<V>(&self, _visitor: &mut V) -> bool
|
||||
where V: SelectorVisitor<Impl = Self::Impl> { true }
|
||||
}
|
||||
|
||||
|
@ -1501,4 +1501,26 @@ pub mod tests {
|
|||
specificity: specificity(1, 1, 0),
|
||||
}))));
|
||||
}
|
||||
|
||||
struct TestVisitor {
|
||||
seen: Vec<String>,
|
||||
}
|
||||
|
||||
impl SelectorVisitor for TestVisitor {
|
||||
type Impl = DummySelectorImpl;
|
||||
|
||||
fn visit_simple_selector(&mut self, s: &SimpleSelector<DummySelectorImpl>) -> bool {
|
||||
let mut dest = String::new();
|
||||
s.to_css(&mut dest).unwrap();
|
||||
self.seen.push(dest);
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn visitor() {
|
||||
let mut test_visitor = TestVisitor { seen: vec![], };
|
||||
parse(":not(:hover) ~ label").unwrap().0[0].visit(&mut test_visitor);
|
||||
assert!(test_visitor.seen.contains(&":hover".into()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue