ok/jj
1
0
Fork 0
forked from mirrors/jj

style: make normalize_output() take a &str instead of a String

This commit is contained in:
Samuel Tardieu 2023-01-24 14:30:22 +01:00
parent 797189b106
commit 31d7bf02ce

View file

@ -84,7 +84,7 @@ impl TestEnvironment {
/// 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 {
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
@ -92,7 +92,7 @@ impl TestEnvironment {
#[must_use]
pub fn jj_cmd_failure(&self, current_dir: &Path, args: &[&str]) -> String {
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
@ -100,7 +100,7 @@ impl TestEnvironment {
#[must_use]
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("");
self.normalize_output(get_stderr_string(&assert))
self.normalize_output(&get_stderr_string(&assert))
}
pub fn env_root(&self) -> &Path {
@ -182,7 +182,7 @@ impl TestEnvironment {
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 regex = Regex::new(&format!(
r"{}(\S+)",