silcrow 0.2.0

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

#[test]
fn color_change_moves() {
    let a = ".a { color: red; }\n";
    let b = ".a { color: blue; }\n";
    assert_ne!(pair(&CSS, a, 1).shape, pair(&CSS, b, 1).shape);
}

#[test]
fn selector_change_moves() {
    let a = ".a { color: red; }\n";
    let b = ".b { color: red; }\n";
    assert_ne!(pair(&CSS, a, 1).shape, pair(&CSS, b, 1).shape);
}

#[test]
fn a_number_before_its_unit_moves() {
    moves(&CSS, ".a { width: 100px; }\n", ".a { width: 1px; }\n", 1);
    moves(&CSS, ".a { width: 50%; }\n", ".a { width: 5%; }\n", 1);
}

#[test]
fn whitespace_in_a_string_moves() {
    moves(
        &CSS,
        ".a { content: \"a  b\"; }\n",
        ".a { content: \"a b\"; }\n",
        1,
    );
    stays(
        &CSS,
        ".a { content: \"a\"; }\n",
        ".a { content: 'a'; }\n",
        1,
    );
}

#[test]
fn a_media_query_reaches_a_rule_inside() {
    let at = |q: &str| format!("@media (max-width: {q}) {{\n  .a {{\n    color: red;\n  }}\n}}\n");
    moves(&CSS, &at("100px"), &at("900px"), 2);
}

#[test]
fn hex_color_case_stays() {
    stays(&CSS, ".a { color: #FFF; }\n", ".a { color: #fff; }\n", 1);
}