#[cfg(test)]
pub fn test_case(_name: &str, script: &[u8], expected_output: &[u8]) {
    use pish::parse::Parse;
    use pish::rw::*;
    use std::io::Read;
    use std::sync::{Arc, Mutex};

    let session = Arc::new(Mutex::new(pish::Session::new_noninteractive()));
    let script = pish::parse::Script::parse_from_bytes(script).unwrap();
    let (stdin, _c1) = InputReader::new(Input::Null);
    let (mut pr, pw) = std::io::pipe().unwrap();
    let (stdout, _c2) = OutputWriter::new(Output::Pipe(pw));
    let mut exec = pish::run::Executor::new(session.clone());
    let mut spawned = exec.execute_script(script, stdin, stdout);
    let _res = spawned.join_timeout(1000);
    let mut actual_output = Vec::new();
    pr.read_to_end(&mut actual_output).unwrap();
    assert_eq!(
        expected_output,
        actual_output,
        "\nexpected: {}\n  actual: {}",
        expected_output.escape_ascii(),
        actual_output.escape_ascii()
    );
}
