silcrow 0.2.0

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

#[test]
fn attr_value_moves() {
    let a = "resource \"a\" \"b\" {\n  x = 1\n}\n";
    let b = "resource \"a\" \"b\" {\n  x = 2\n}\n";
    assert_ne!(pair(&HCL, a, 1).shape, pair(&HCL, b, 1).shape);
}

#[test]
fn block_type_moves() {
    let a = "resource \"a\" \"b\" {\n  x = 1\n}\n";
    let b = "data \"a\" \"b\" {\n  x = 1\n}\n";
    assert_ne!(pair(&HCL, a, 1).shape, pair(&HCL, b, 1).shape);
}

#[test]
fn attr_name_moves() {
    let a = "resource \"a\" \"b\" {\n  x = 1\n}\n";
    let b = "resource \"a\" \"b\" {\n  y = 1\n}\n";
    assert_ne!(pair(&HCL, a, 1).shape, pair(&HCL, b, 1).shape);
}

#[test]
fn whitespace_in_a_template_moves() {
    let f = |s: &str| format!("resource \"a\" \"b\" {{\n  x = \"p{s}${{var.q}}\"\n}}\n");
    moves(&HCL, &f("  "), &f(" "), 1);
}