md-cli 0.6.0

CLI for the Mnemonic Descriptor (MD) engravable BIP 388 wallet policy backup format
#![allow(missing_docs)]

// Unix-only: this test shells out to the system `diff` command which is not
// standard on Windows. The corpus is platform-invariant (regenerated vectors
// are byte-identical regardless of OS), so Unix CI coverage is sufficient.
#[cfg(unix)]
use assert_cmd::Command;
#[cfg(unix)]
use std::process::Command as StdCommand;
#[cfg(unix)]
use tempfile::tempdir;

#[cfg(all(unix, feature = "json"))]
#[test]
fn vectors_output_matches_committed_corpus() {
    let tmp = tempdir().unwrap();
    Command::cargo_bin("md")
        .unwrap()
        .args(["vectors", "--out", tmp.path().to_str().unwrap()])
        .assert()
        .success();
    let committed = format!("{}/../md-codec/tests/vectors", env!("CARGO_MANIFEST_DIR"));
    // Compare every committed corpus file against the freshly-generated tmp tree.
    // Use --exclude to skip the manifest (source-of-truth, not a generated artifact)
    // and the .gitkeep marker.
    let status = StdCommand::new("diff")
        .args([
            "-r",
            "--exclude=manifest.rs",
            "--exclude=.gitkeep",
            // The BIP-341 upstream wallet-test-vectors.json fixture lives
            // alongside the md-codec corpus as the host for
            // `bip341_wallet_vectors.rs`, but isn't generated by `md vectors`.
            // Exclude from the corpus-drift diff. Cycle: v0.8.0 Phase 1.
            "--exclude=bip341-wallet-test-vectors.json",
            tmp.path().to_str().unwrap(),
            &committed,
        ])
        .status()
        .unwrap();
    assert!(status.success(), "vectors corpus drift detected");
}