use visdom::{types::BoxDynError, Vis};
#[test]
#[should_panic]
fn test_wrong_html() {
let html = r#"
<!doctype html>
<html>
<head></head>
<aa></a>
</html>
"#;
let _ = Vis::load_options(html, Default::default()).unwrap();
}
#[test]
fn test_wrong_html_catch() {
let html = r#"
<!doctype html>
<html>
<head></head>
<aa></a>
</html>
"#;
let _ = Vis::load_options_catch(
html,
Default::default(),
Box::new(|_| {
}),
);
}
#[test]
#[should_panic]
fn test_wrong_selector() {
let html = r#"
<!doctype html>
<html>
<head></head>
<a></a>
</html>
"#;
let root = Vis::load_options_catch(
html,
Default::default(),
Box::new(|e: BoxDynError| {
panic!("{:?}", e.to_string());
}),
);
let _ = root.find("a:all-childs");
}
#[test]
fn test_wrong_selector_catch() {
let html = r#"
<!doctype html>
<html>
<head></head>
<a></a>
</html>
"#;
let root = Vis::load_catch(
html,
Box::new(|_: BoxDynError| {
}),
);
let _ = root.find("a:all-childs");
}