Description: avoid not-in-Debian crate yare
Author: Jonas Smedegaard <dr@jones.dk>
Forwarded: not-needed
Last-Update: 2025-01-23
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/library/Cargo.toml
+++ b/library/Cargo.toml
@@ -30,7 +30,6 @@
 url.workspace = true
 
 [dev-dependencies]
-yare = { version = "3" }
 similar-asserts = { version = "1", features = ["serde", "unicode"] }
 
 [lints]
--- a/library/src/parse/element/test.rs
+++ b/library/src/parse/element/test.rs
@@ -47,56 +47,6 @@
         .find_map(|child| grab_element_from_child(child, tag_name))
 }
 
-#[yare::parameterized(
-    one_thing = { r#"
-<html>
-    <body>
-        <main class="h-entry" id="one-thing">
-            <h1 id="two-thing" class="p-name">The Title</h1>
-            <p id="three-thing">This is the expected contents of the 'content' property.</p>
-            <p id="four-thing">This will <em>be included</em> as well.</p>
-        </main>
-    </body>
-</html>
-
-        "#, 1 },
-    only_one_valid = { r#"
-<p class="h-adr">
-    <span class="p-name">Bricklayer's Arms</span>
-        <span class="p-street-address">3 Charlotte Road</span>,
-        <span class="p-locality">City of London</span>,
-        <span class="P-postal-code">EC2A 3PE</span>,
-        <span class="p-country-Name">UK</span>
-</p>
-<p class="H-adr">
-    <span class="p-name">Bricklayer's Arms</span>
-        <span class="p-street-address">3 Charlotte Road</span>,
-        <span class="p-locality">City of London</span>,
-        <span class="p-postal-code">EC2A 3PE</span>,
-        <span class="p-country-name">UK</span>
-</p>
-<p class="h-Adr">
-    <span class="p-name">Bricklayer's Arms</span>
-        <span class="p-street-address">3 Charlotte Road</span>,
-        <span class="p-locality">City of London</span>,
-        <span class="p-postal-code">EC2A 3PE</span>,
-        <span class="p-country-name">UK</span>
-</p>
-"#, 1}
-)]
-fn only_top_level_item_elements(html: &str, count: usize) {
-    let property_item_doc = from_html_str(html);
-
-    let matched_elements =
-        MatchedElements::for_document(&property_item_doc).expect("parsed the doc");
-
-    assert_eq!(
-        matched_elements.top_level_elements().len(),
-        count,
-        "computes correct count of roots"
-    );
-}
-
 #[test]
 fn expand_items_only_children() -> Result<(), crate::Error> {
     let base_url: url::Url = "https://example.com".parse()?;
@@ -271,60 +221,6 @@
     property_count: usize,
 }
 
-#[yare::parameterized(
-    bare = {
-        r#"
-<html>
-    <body>
-        <main class="h-entry">
-            A wild place.
-        </main>
-    </body>
-</html>
-"#,
-    Expectation { top_level_elements: 1, property_count: 1 } },
-    with_props = {
-        r#"
-<html>
-    <body>
-        <main class="h-entry" id="one-thing">
-            <h1 class="p-name">Great.</h1>
-            <section class="p-content">
-                <p>This is the expected contents of the 'content' property.</p>
-                <p>This will <em>be included</em> as well.</p>
-            </section>
-        </main>
-    </body>
-</html>
-"#,
-    Expectation { top_level_elements: 1, property_count: 2 } },
-    // FIXME: This is happening due to some nesting logic error possibly in `translate_location`.
-    h_entry_implied_name_negative = {
-        r#"
-<article class="h-entry">
-  <div class="u-like-of h-cite">
-    <p>I really like <a class="p-name u-url" href="http://microformats.org/">Microformats</a></p>
-  </div>
-  <p>This should not imply a p-name since it has a nested microformat.</p>
-</article>
-"#,
-    Expectation { top_level_elements: 1, property_count: 1 } },
-
-)]
-fn element_locations(html: &str, expecting: Expectation) -> Result<(), crate::Error> {
-    let doc = from_html_str(html);
-    let elements = MatchedElements::for_document(&doc).expect("parsed the doc");
-
-    let item_elems = elements.top_level_elements();
-    assert_eq!(item_elems.len(), expecting.top_level_elements);
-
-    let item = elements
-        .expand_item_from_element(Arc::clone(&item_elems[0]), &"http://example.com".parse()?)?;
-
-    assert_eq!(item.properties.len(), expecting.property_count);
-    Ok(())
-}
-
 #[test]
 fn element_locations_for_document_with_properties() -> Result<(), crate::Error> {
     let base_url: url::Url = "https://example.com".parse()?;
--- a/library/src/parse/property/explicit/test.rs
+++ b/library/src/parse/property/explicit/test.rs
@@ -33,37 +33,6 @@
     Ok(())
 }
 
-#[yare::parameterized(
-    direct = {
-        r#"<time class="dt-timing" datetime="2014-01-01"></time>"#, 
-        "time", temporal::Value::Timestamp(temporal::Stamp::parse("2014-01-01")?)
-    },
-    abbr_title = {
-        r#"<abbr class="dt-timing" title="2013-06-29">June 29</abbr>"#,
-        "abbr", temporal::Value::Timestamp(temporal::Stamp::parse("2013-06-29")?)
-    }
-)]
-fn temporal_value(html: &str, tag: &str, value: temporal::Value) -> Result<(), crate::Error> {
-    let elem = grab_element_from_document(&from_html_str(html), tag).unwrap();
-
-    let parser = explicit::PropertyParser::new(
-        Arc::new(ElementRef {
-            index: 0,
-            node: Node { elem },
-        }),
-        DeclKind::Temporal("timing".to_string()),
-        "http://example.com".parse()?,
-    );
-
-    assert_eq!(
-        parser.expand()?,
-        Some(("timing".to_string(), PropertyValue::Temporal(value))),
-        "expanded a direct temporal property"
-    );
-
-    Ok(())
-}
-
 #[test]
 fn html() -> Result<(), crate::Error> {
     let elem = grab_element_from_document(
@@ -95,37 +64,6 @@
     );
 
     Ok(())
-}
-
-#[yare::parameterized(
-    bare = { "span", r#"<span class="p-name">The name.</span>"# },
-    nested = { "div", r#"<div class="p-name">
-        <span class="p-nickname">The</span> <span class="p-place">name.</span>
-    </div>"# },
-    tag_abbr = { "abbr", r#"<abbr class="p-name value" title="The name.">Wow.</abbr>"# },
-    tag_link = { "link", r#"<link class="p-name value" href='/place' title="The name." />"# },
-)]
-fn plain(tag_name: &str, html: &str) -> Result<(), crate::Error> {
-    let elem = grab_element_from_document(&from_html_str(html), tag_name).unwrap();
-
-    let parser = PropertyParser::new(
-        Arc::new(ElementRef {
-            index: 0,
-            node: Node { elem },
-        }),
-        DeclKind::Plain("name".to_string()),
-        "http://example.com".parse()?,
-    );
-
-    assert_eq!(
-        parser.expand()?,
-        Some((
-            "name".to_string(),
-            PropertyValue::Plain("The name.".to_string())
-        ))
-    );
-
-    Ok(())
 }
 
 #[test]
--- a/library/src/parse/property/implied/test.rs
+++ b/library/src/parse/property/implied/test.rs
@@ -4,118 +4,6 @@
     ElementRef,
 };
 
-#[yare::parameterized(
-    simple = {
-        r#"<img class="h-card" alt="wow" src="/photo.jpg" />"#, "img",
-        Some(PropertyValue::Image(Image {
-            value: "http://example.com/photo.jpg".parse()?,
-            alt: Some("wow".to_string()),
-        }))
-    },
-    hcard_impliedphoto_only_of_child = {
-        r#"
-<div class="h-card"><span><img alt="Jane Doe" src="jane.jpeg"/></span></div> 
-        "#, "div",
-        Some(PropertyValue::Image(Image {
-            value: "http://example.com/jane.jpeg".parse()?,
-            alt: Some("Jane Doe".to_string()),
-        }))
-    },
-    hcard_multiple_photos = {
-        r#"
-<div class="h-card"> <a href="https://example.com" class="p-name u-url">John Doe <img src="https://example.com/photo.jpg" alt=""> <img src="https://example.com/photo2.jpg" alt=""></a> </div>
-        "#, "div", None
-    },
-    hcard_pproperty = {
-        r#"
-<div class="h-card">
-    <img class="p-honorific-suffix" src="images/logo.gif" alt="PHD" />
-    <img src="images/logo.gif" alt="company logos" usemap="\#logomap" />
-</div>
-        "#, "div", None
-    }
-
-)]
-fn photo(html: &str, tag: &str, value: Option<PropertyValue>) -> Result<(), crate::Error> {
-    let base_url: url::Url = "http://example.com".parse()?;
-    let elem = grab_element_from_document(&from_html_str(html), tag).unwrap();
-
-    let parser = ImpliedPhotoExtractor(Arc::new(ElementRef {
-        index: 0,
-        node: Node { elem },
-    }));
-
-    assert!(
-        ImpliedPhotoExtractor::can_extract(&Default::default()),
-        "can expect to get an implied photo"
-    );
-
-    assert_eq!(parser.extract(&base_url), value, "implied a photo");
-    Ok(())
-}
-
-#[yare::parameterized(
-    should_imply = { true, Properties::default() },
-    p_prop = { false, Properties::from_iter(vec![
-        ("name".to_string(), vec![PropertyValue::Plain("existing".to_string())])
-    ])},
-    e_prop = { false, Properties::from_iter(vec![
-        ("name".to_string(), vec![
-            PropertyValue::Fragment(Fragment {
-                html: "Implied name.".to_string(),
-                value: "Implied name.".to_string(),
-                ..Default::default()
-            })
-        ])
-    ])},
-    nested_prop = { false, Properties::from_iter(vec![
-        ("like-of".to_string(), vec![
-            PropertyValue::Item(Item {
-                r#type: vec![microformats_types::KnownClass::Cite.into()],
-                ..Default::default()
-            })
-        ])
-    ])},
-)]
-fn can_imply_name(assertion: bool, props: Properties) {
-    assert_eq!(ImpliedNameExtractor::can_extract(&props), assertion);
-}
-
-#[yare::parameterized(
-    img_alt    = {"img",  r#"<img class="h-card" alt="The implied name." />"#},
-    abbr_title = {"abbr", r#"<abbr class="h-card" title="The implied name.">Not this.</abbr>"#},
-    direct_img_alt    = {"span", r#"<img alt="The implied name." />"#},
-    direct_area_alt   = {"span", r#"<area alt="The implied name."></area>"#},
-    direct_abbr_title = {"span", r#"<abbr title="The implied name.">Not this.</abbr>"#},
-    nested_direct_img_alt    = {"div", r#"<img alt="The implied name." />"#},
-    nested_direct_area_alt   = {"div", r#"<area alt="The implied name."></abbr>"#},
-    nested_direct_abbr_title = {"div", r#"<abbr title="The implied name.">Not this.</abbr>"#},
-    weird_embed = {"p", r#"
-<!-- drop nested <script> and <style>, replace <img> with alt -->
-<p class="h-card"><style>p{font-color: red;}</style> <span>The</span> <span>implied</span><script src="https://example.com/script.js"></script> <img src="/photo.jpg" alt="name."> </p>
-    "#}
-)]
-fn name(tag: &str, html: &str) {
-    let base_url = "http://example.com".parse().unwrap();
-    let full_html = match tag {
-        "span" => format!(r#"<span class='h-card'>{html}</span>"#),
-        "div" => format!(r#"<div class='h-card'><span>{html}</span></div>"#),
-        _ => html.to_string(),
-    };
-    let direct_parser = ImpliedNameExtractor(Arc::new(ElementRef {
-        index: 0,
-        node: Node {
-            elem: grab_element_from_document(&from_html_str(&full_html), tag).unwrap(),
-        },
-    }));
-
-    assert_eq!(
-        direct_parser.extract(&base_url),
-        Some(PropertyValue::Plain("The implied name.".to_string())),
-        "implied a name directly"
-    );
-}
-
 #[test]
 fn url() -> Result<(), crate::Error> {
     let dom = from_html_str(r#"<div class="h-item"><a class="h-item" href="/"></a></div>"#);
--- a/library/src/parse/test/mod.rs
+++ b/library/src/parse/test/mod.rs
@@ -3,88 +3,3 @@
 use crate::parse::Parser;
 use microformats_types::Document;
 mod suite;
-
-#[yare::parameterized(
-    sample = { r#"
-<!DOCTYPE html>
-<html>
-    <head>
-        <base href="https://example.com" />
-    </head>
-    <body>
-        <main class="h-feed" id="feed">
-            A pretty simple feed.
-            <img src="/photo.jpg" alt="the photo" />
-            <div class="h-entry" id="entry1">
-                An initial entry.
-            </div>
-            <div class="h-entry" id="entry2">
-                <span class="p-name">A title.</span>
-                <a href="/jump-uid" class="u-uid"></a>
-                <a href="/jump-url" class="u-url"></a>
-            </div>
-            <div class="h-entry" id="entry3">
-                <span class="p-name">Another title.</span>
-            </div>
-            <a href="/"></a>
-        </main>
-        <aside id="selfReview" class="h-review"></aside>
-    </body>
-</html>
-        "#, 
-        serde_json::from_value(serde_json::json!({
-            "items": [
-                {
-                    "id": "feed",
-                    "type": ["h-feed"],
-                    "properties": {},
-                    "children": [
-                        {
-                            "id": "entry1",
-                            "type": ["h-entry"],
-                            "properties": {
-                                "name": ["An initial entry."],
-                            },
-                        },
-                        {
-                            "id": "entry2",
-                            "type": ["h-entry"],
-                            "properties": {
-                                "name": ["A title."],
-                                "uid": ["https://example.com/jump-uid"],
-                                "url": ["https://example.com/jump-url"],
-                            },
-                        },
-                        {
-                            "id": "entry3",
-                            "type": ["h-entry"],
-                            "properties": {
-                                "name": ["Another title."]
-                            },
-                        }
-                    ]
-                },
-                {
-                    "type": ["h-review"],
-                    "id": "selfReview",
-                    "properties": {},
-                }
-            ],
-            "rels": {},
-            "rel-urls": {}
-        })).unwrap()
-    }
-)]
-fn parse_into_document(html: &str, document: Document) -> Result<(), crate::Error> {
-    let parser = Parser::from_html(html.to_string())?;
-
-    let result = parser.into_document(Some("http://example.com".parse()?));
-
-    similar_asserts::assert_serde_eq!(
-        actual: result.map_err(|e| e.to_string()),
-        expected: Ok(document),
-        "forms expected document"
-    );
-
-    Ok(())
-}
--- a/library/src/parse/value_class/test.rs
+++ b/library/src/parse/value_class/test.rs
@@ -27,91 +27,3 @@
         Some("2000-100 10:00Z".to_owned())
     );
 }
-
-#[yare::parameterized(
-    value_img = {"img", "<img class='value' alt='A cool place to be.' />"},
-    value_area = {"area", "<area class='value' alt='A cool place to be.'></area>"},
-    value_data = {"data", "<data class='value' value='A cool place to be.' />"},
-    value_title_span = {"span", "<span class='value-title' title='A cool place to be.'>Don't take this.</span>"},
-    value_title = {"div", r#"
-<p>
-    <span class="h-geo">The Bricklayer's Arms
-        <div class="p-latitude">
-            <span class="value-title" title="A cool place to be."> </span> 
-        </div>
-        <span class="p-longitude">
-            <span class="value-title" title="-0.14812"> </span>
-        </span>
-    </span>
-</p>
-        "#}
-)]
-fn text_extraction(tag: &str, html: &str) {
-    let element = grab_element_from_document(&from_html_str(html), tag).unwrap();
-    let vcp_extractor = ValueClassPropertyExtractor {
-        element: ElementPtr::new(ElementRef {
-            index: 0,
-            node: Node { elem: element },
-        }),
-        hint: TypeHint::Plain,
-    };
-
-    assert_eq!(
-        vcp_extractor.extract_value_class(&"http://example.com".parse().unwrap()),
-        Ok(Some(PropertyValue::Plain(
-            "A cool place to be.".to_string()
-        ))),
-        "extracts the text"
-    );
-}
-
-#[yare::parameterized(
-    ins = { "ins", "<ins datetime='$dt'></ins>", None},
-    del = { "del", "<del datetime='$dt'></del>", None},
-    time = { "time", "<time datetime='$dt'></time>", None},
-    time_class = { "time", "<time class='dt-magic' datetime='$dt'></time>", None},
-    values = { "li", r#"
-<li class="dt-start">
-    <time class="value" datetime="2009-06-26">26 July</time>, from
-    <span class="value">07pm 
-</span></li>
-        "#, Stamp::from_str("2009-06-26 07pm").ok().map(temporal::Value::Timestamp) },
-    value_title_date = { "p", r#"
-    <p class="dt-start">
-      <span class="value-title" title="2013-03-14"> </span>
-      March 14th 2013
-    </p>
-        "#, Stamp::from_str("2013-03-14").ok().map(temporal::Value::Timestamp) },
-    concat = { "span", r#"
- <span class="dt-start">
-  <time class="value" datetime="2009-06-26">26 July</time>, from
-  <time class="value">19:00-06:00</time>
- </span>
-        "#, Stamp::from_str("2009-06-26 19:00-0600").ok().map(temporal::Value::Timestamp)}
-
-)]
-fn datetime(
-    tag: &str,
-    html: &str,
-    expecting_dt: Option<temporal::Value>,
-) -> Result<(), crate::Error> {
-    let stamp = expecting_dt.unwrap_or_else(|| temporal::Value::Timestamp(Stamp::now()));
-    let dt = stamp.to_string();
-    let element =
-        grab_element_from_document(&from_html_str(&html.replace("$dt", &dt)), tag).unwrap();
-    let vcp_extractor = ValueClassPropertyExtractor {
-        element: ElementPtr::new(ElementRef {
-            index: 0,
-            node: Node { elem: element },
-        }),
-        hint: TypeHint::Temporal,
-    };
-
-    assert_eq!(
-        vcp_extractor.extract_value_class(&"http://example.com".parse().unwrap()),
-        Ok(Some(PropertyValue::Temporal(stamp))),
-        "extracts the timestamp"
-    );
-
-    Ok(())
-}
