mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-12 15:16:35 +00:00
style: make normalize_output() take a &str instead of a String
This commit is contained in:
parent
797189b106
commit
31d7bf02ce
1 changed files with 4 additions and 4 deletions
|
@ -84,7 +84,7 @@ impl TestEnvironment {
|
||||||
/// Run a `jj` command, check that it was successful, and return its stdout
|
/// Run a `jj` command, check that it was successful, and return its stdout
|
||||||
pub fn jj_cmd_success(&self, current_dir: &Path, args: &[&str]) -> String {
|
pub fn jj_cmd_success(&self, current_dir: &Path, args: &[&str]) -> String {
|
||||||
let assert = self.jj_cmd(current_dir, args).assert().success().stderr("");
|
let assert = self.jj_cmd(current_dir, args).assert().success().stderr("");
|
||||||
self.normalize_output(get_stdout_string(&assert))
|
self.normalize_output(&get_stdout_string(&assert))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run a `jj` command, check that it failed with code 1, and return its
|
/// Run a `jj` command, check that it failed with code 1, and return its
|
||||||
|
@ -92,7 +92,7 @@ impl TestEnvironment {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn jj_cmd_failure(&self, current_dir: &Path, args: &[&str]) -> String {
|
pub fn jj_cmd_failure(&self, current_dir: &Path, args: &[&str]) -> String {
|
||||||
let assert = self.jj_cmd(current_dir, args).assert().code(1).stdout("");
|
let assert = self.jj_cmd(current_dir, args).assert().code(1).stdout("");
|
||||||
self.normalize_output(get_stderr_string(&assert))
|
self.normalize_output(&get_stderr_string(&assert))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run a `jj` command and check that it failed with code 2 (for invalid
|
/// Run a `jj` command and check that it failed with code 2 (for invalid
|
||||||
|
@ -100,7 +100,7 @@ impl TestEnvironment {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn jj_cmd_cli_error(&self, current_dir: &Path, args: &[&str]) -> String {
|
pub fn jj_cmd_cli_error(&self, current_dir: &Path, args: &[&str]) -> String {
|
||||||
let assert = self.jj_cmd(current_dir, args).assert().code(2).stdout("");
|
let assert = self.jj_cmd(current_dir, args).assert().code(2).stdout("");
|
||||||
self.normalize_output(get_stderr_string(&assert))
|
self.normalize_output(&get_stderr_string(&assert))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn env_root(&self) -> &Path {
|
pub fn env_root(&self) -> &Path {
|
||||||
|
@ -182,7 +182,7 @@ impl TestEnvironment {
|
||||||
edit_script
|
edit_script
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn normalize_output(&self, text: String) -> String {
|
pub fn normalize_output(&self, text: &str) -> String {
|
||||||
let text = text.replace("jj.exe", "jj");
|
let text = text.replace("jj.exe", "jj");
|
||||||
let regex = Regex::new(&format!(
|
let regex = Regex::new(&format!(
|
||||||
r"{}(\S+)",
|
r"{}(\S+)",
|
||||||
|
|
Loading…
Reference in a new issue