MCPcopy Create free account
hub / github.com/untitaker/hyperlink / test_json_script

Function test_json_script

src/html/mod.rs:783–799  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

781
782#[test]
783fn test_json_script() {
784 use crate::paragraph::ParagraphHasher;
785
786 let doc = Document::new(Path::new("/"), Path::new("/html5gum/struct.Tokenizer.html"));
787
788 let html = r#"<script type="text/json" id="notable-traits-data">{"InfallibleTokenizer<R, E>":"<h3>Notable traits for <code><a class=\"struct\" href=\"struct.InfallibleTokenizer.html\" title=\"struct html5gum::InfallibleTokenizer\">InfallibleTokenizer</a>&lt;R, E&gt;</code></h3><pre><code><div class=\"where\">impl&lt;R: <a class=\"trait\" href=\"trait.Reader.html\" title=\"trait html5gum::Reader\">Reader</a>&lt;Error = <a class=\"enum\" href=\"https://doc.rust-lang.org/1.82.0/core/convert/enum.Infallible.html\" title=\"enum core::convert::Infallible\">Infallible</a>&gt;, E: <a class=\"trait\" href=\"emitters/trait.Emitter.html\" title=\"trait html5gum::emitters::Emitter\">Emitter</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/1.82.0/core/iter/traits/iterator/trait.Iterator.html\" title=\"trait core::iter::traits::iterator::Iterator\">Iterator</a> for <a class=\"struct\" href=\"struct.InfallibleTokenizer.html\" title=\"struct html5gum::InfallibleTokenizer\">InfallibleTokenizer</a>&lt;R, E&gt;</div><div class=\"where\"> type <a href=\"https://doc.rust-lang.org/1.82.0/core/iter/traits/iterator/trait.Iterator.html#associatedtype.Item\" class=\"associatedtype\">Item</a> = E::<a class=\"associatedtype\" href=\"emitters/trait.Emitter.html#associatedtype.Token\" title=\"type html5gum::emitters::Emitter::Token\">Token</a>;</div>"}</script>"#;
789
790 let mut doc_buf = DocumentBuffers::default();
791
792 let mut links = Vec::new();
793 doc.links_from_read::<_, ParagraphHasher, _>(&mut doc_buf, html.as_bytes(), false, |link| {
794 links.push(link)
795 })
796 .unwrap();
797
798 assert_eq!(links, &[]);
799}
800
801#[test]
802fn test_redirects_dynamic_placeholders() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…