// ██████╗ █████╗ ███████╗███████╗██╗███╗ ██╗ ██████╗ // ██╔══██╗██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝ // ██████╔╝███████║███████╗███████╗██║██╔██╗ ██║██║ ███╗ // ██╔═══╝ ██╔══██║╚════██║╚════██║██║██║╚██╗██║██║ ██║ // ██║ ██║ ██║███████║███████║██║██║ ╚████║╚██████╔╝ // ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝ #[cfg(test)] mod passing { use monolith::html; #[test] fn meta_content_type() { let html = "
"; let dom = html::html_to_dom(&html.as_bytes().to_vec(), "".to_string()); assert_eq!(html::get_charset(&dom.document), Some("GB2312".to_string())); } #[test] fn meta_charset() { let html = " "; let dom = html::html_to_dom(&html.as_bytes().to_vec(), "".to_string()); assert_eq!(html::get_charset(&dom.document), Some("GB2312".to_string())); } #[test] fn multiple_conflicting_meta_charset_first() { let html = " "; let dom = html::html_to_dom(&html.as_bytes().to_vec(), "".to_string()); assert_eq!(html::get_charset(&dom.document), Some("utf-8".to_string())); } #[test] fn multiple_conflicting_meta_content_type_first() { let html = " "; let dom = html::html_to_dom(&html.as_bytes().to_vec(), "".to_string()); assert_eq!(html::get_charset(&dom.document), Some("GB2312".to_string())); } }