Kept
", "Weight one
", "Weight two
", ]); assert_eq!( data.digest, "Weight one. ___PAGEFIND_WEIGHT___2 Weight two. ___END_PAGEFIND_WEIGHT___" ) } #[test] fn words_ids() { let data = test_parse(vec![ "Sentence one
", "Sentence two
", ]); assert_eq!( data.digest, "Sentence one. ___PAGEFIND_ANCHOR___br:0:break ___PAGEFIND_ANCHOR___p:1:pid Sentence two." ) } #[test] fn explicit_anchor_titles() { let data = test_parse(vec![ "Sentences should have periods
", "Unless one exists.
", "Inline tags like span", " and bol", "d shouldn't have periods
", "And should not add any space.
", ]); assert_eq!( data.digest, "Inline tags like span and bold shouldn't have periods. And should not add any space." ) } #[test] fn ignored_elements() { let data = test_parse(vec![ "Elements like:
", "", "forms
", "Elements
",
"",
]);
assert_eq!(data.meta.get("image"), Some(&"/kitty.jpg".to_owned()));
assert_eq!(data.meta.get("type"), Some(&"post".to_owned()));
assert_eq!(data.meta.get("headline"), Some(&"Hello World".to_owned()));
assert_eq!(data.meta.get("adj"), Some(&"hella".to_owned()));
assert_eq!(data.meta.get("hero"), Some(&"/huzzah.png".to_owned()));
}
#[test]
fn return_complex_metadata() {
let data = test_raw_parse(vec![
"",
"
",
"