mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
fix(tests): use cargo_bin_cmd for apply_patch
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use assert_cmd::prelude::*;
|
||||
use std::fs;
|
||||
use std::process::Command;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
@@ -16,7 +15,7 @@ fn test_apply_patch_cli_add_and_update() -> anyhow::Result<()> {
|
||||
+hello
|
||||
*** End Patch"#
|
||||
);
|
||||
Command::new(assert_cmd::cargo::cargo_bin!("apply_patch"))
|
||||
assert_cmd::cargo::cargo_bin_cmd!("apply_patch")
|
||||
.arg(add_patch)
|
||||
.current_dir(tmp.path())
|
||||
.assert()
|
||||
@@ -33,7 +32,7 @@ fn test_apply_patch_cli_add_and_update() -> anyhow::Result<()> {
|
||||
+world
|
||||
*** End Patch"#
|
||||
);
|
||||
Command::new(assert_cmd::cargo::cargo_bin!("apply_patch"))
|
||||
assert_cmd::cargo::cargo_bin_cmd!("apply_patch")
|
||||
.arg(update_patch)
|
||||
.current_dir(tmp.path())
|
||||
.assert()
|
||||
@@ -57,7 +56,7 @@ fn test_apply_patch_cli_stdin_add_and_update() -> anyhow::Result<()> {
|
||||
+hello
|
||||
*** End Patch"#
|
||||
);
|
||||
let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("apply_patch"));
|
||||
let mut cmd = assert_cmd::cargo::cargo_bin_cmd!("apply_patch");
|
||||
cmd.current_dir(tmp.path());
|
||||
cmd.write_stdin(add_patch)
|
||||
.assert()
|
||||
@@ -74,7 +73,7 @@ fn test_apply_patch_cli_stdin_add_and_update() -> anyhow::Result<()> {
|
||||
+world
|
||||
*** End Patch"#
|
||||
);
|
||||
let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("apply_patch"));
|
||||
let mut cmd = assert_cmd::cargo::cargo_bin_cmd!("apply_patch");
|
||||
cmd.current_dir(tmp.path());
|
||||
cmd.write_stdin(update_patch)
|
||||
.assert()
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use assert_cmd::prelude::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
@@ -36,7 +34,7 @@ fn run_apply_patch_scenario(dir: &Path) -> anyhow::Result<()> {
|
||||
// Run apply_patch in the temporary directory. We intentionally do not assert
|
||||
// on the exit status here; the scenarios are specified purely in terms of
|
||||
// final filesystem state, which we compare below.
|
||||
Command::new(assert_cmd::cargo::cargo_bin!("apply_patch"))
|
||||
assert_cmd::cargo::cargo_bin_cmd!("apply_patch")
|
||||
.arg(patch)
|
||||
.current_dir(tmp.path())
|
||||
.output()?;
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
use assert_cmd::prelude::*;
|
||||
use assert_cmd::Command;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use tempfile::tempdir;
|
||||
|
||||
fn run_apply_patch_in_dir(dir: &Path, patch: &str) -> anyhow::Result<assert_cmd::assert::Assert> {
|
||||
let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("apply_patch"));
|
||||
let mut cmd = assert_cmd::cargo::cargo_bin_cmd!("apply_patch");
|
||||
cmd.current_dir(dir);
|
||||
Ok(cmd.arg(patch).assert())
|
||||
}
|
||||
|
||||
fn apply_patch_command(dir: &Path) -> anyhow::Result<Command> {
|
||||
let mut cmd = Command::new(assert_cmd::cargo::cargo_bin!("apply_patch"));
|
||||
let mut cmd = assert_cmd::cargo::cargo_bin_cmd!("apply_patch");
|
||||
cmd.current_dir(dir);
|
||||
Ok(cmd)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user