silcrow 0.2.0

Deterministic CLI for a citable, checkable graph of laws in a git tree.
use super::*;

#[test]
fn tag_rename_moves() {
    let a = "<div><span>x</span></div>\n";
    let b = "<div><p>x</p></div>\n";
    assert_ne!(pair(&HTML, a, 1).shape, pair(&HTML, b, 1).shape);
}

#[test]
fn text_change_moves() {
    let a = "<div>hello</div>\n";
    let b = "<div>hello world</div>\n";
    assert_ne!(pair(&HTML, a, 1).shape, pair(&HTML, b, 1).shape);
}

#[test]
fn whitespace_in_pre_or_an_attribute_moves() {
    moves(
        &HTML,
        "<div>\n  <pre>a b</pre>\n</div>\n",
        "<div>\n  <pre>a  b</pre>\n</div>\n",
        1,
    );
    moves(
        &HTML,
        "<p title=\"a b\">t</p>\n",
        "<p title=\"a  b\">t</p>\n",
        1,
    );
    stays(&HTML, "<p title=\"a\">t</p>\n", "<p title='a'>t</p>\n", 1);
    moves(&HTML, "<p>a b</p>\n", "<p>a\u{a0}b</p>\n", 1);
    moves(&HTML, "<p>a b</p>\n", "<p>a\u{3000}b</p>\n", 1);
    stays(&HTML, "<p>a b</p>\n", "<p>a \t\x0c b</p>\n", 1);
    stays(
        &HTML,
        "<div>\n  <p>t u</p>\n</div>\n",
        "<div>\n      <p>t\n         u</p>\n</div>\n",
        1,
    );
}