use rquery::Document; fn new_document() -> Document { Document::new_from_xml_string(r#"
This is some text
"#).unwrap() } #[test] fn it_knows_its_tag_name() { let document = new_document(); let element = document.select("main").unwrap(); assert_eq!(element.tag_name(), "main"); } #[test] fn it_knows_its_attributes() { let document = new_document(); let element = document.select("main").unwrap(); assert_eq!(element.attr("type").unwrap(), "simple"); } #[test] fn it_knows_its_inner_text_contents() { let document = new_document(); let element = document.select("main").unwrap(); assert_eq!(element.text().trim(), "This is some text"); } #[test] fn it_knows_its_node_indices() { let document = new_document(); let element = document.select("main").unwrap(); assert_eq!(element.node_index(), 1); }