Add CLI test for --exit-code

pull/492/head
Wilfred Hughes 2023-02-22 00:01:36 +07:00
parent 2ff20e3aa8
commit adb25ed7f5
1 changed files with 16 additions and 0 deletions

@ -8,3 +8,19 @@ fn no_such_files() {
cmd.arg("no_such_file").arg("no_such_file_either");
cmd.assert().failure().code(2);
}
#[test]
fn has_changes_default_exit_code() {
let mut cmd = Command::cargo_bin("difft").unwrap();
cmd.arg("sample_files/simple_before.js").arg("sample_files/simple_after.js");
cmd.assert().success();
}
#[test]
fn has_changes_requested_exit_code() {
let mut cmd = Command::cargo_bin("difft").unwrap();
cmd.arg("--exit-code").arg("sample_files/simple_before.js").arg("sample_files/simple_after.js");
cmd.assert().failure().code(1);
}