patsh 0.2.1

A command-line tool for patching shell scripts
Documentation
use std::{fs, str};

use assert_cmd::Command;
use expect_test::expect_file;
use tempfile::tempdir;

#[test]
fn basic() {
    check("basic");
}

#[test]
fn escape() {
    check("escape");
}

#[test]
fn exec() {
    check("exec");
}

fn check(name: &str) {
    let dir = tempdir().unwrap();
    let out = dir.path().join(format!("{name}-actual.sh"));

    Command::new(env!("CARGO_BIN_EXE_patsh"))
        .arg(format!("tests/fixtures/{name}.sh"))
        .arg(&out)
        .unwrap();

    expect_file!(format!("fixtures/{name}-expected.sh"))
        .assert_eq(str::from_utf8(&fs::read(out).unwrap()).unwrap())
}