mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-31 16:33:10 +00:00
cli: use insta snapshot to test editor error messages
This commit is contained in:
parent
d5b0aa20cb
commit
e344c21a28
1 changed files with 10 additions and 2 deletions
|
@ -139,7 +139,11 @@ fn test_describe() {
|
||||||
// Fails if the editor fails
|
// Fails if the editor fails
|
||||||
std::fs::write(&edit_script, "fail").unwrap();
|
std::fs::write(&edit_script, "fail").unwrap();
|
||||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["describe"]);
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["describe"]);
|
||||||
assert!(stderr.contains("exited with an error"));
|
insta::with_settings!({
|
||||||
|
filters => [(r"\bEditor '[^']*'", "Editor '<redacted>'")],
|
||||||
|
}, {
|
||||||
|
insta::assert_snapshot!(stderr, @"Error: Editor '<redacted>' exited with an error");
|
||||||
|
});
|
||||||
|
|
||||||
// ignore everything after the first ignore-rest line
|
// ignore everything after the first ignore-rest line
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
|
@ -412,7 +416,11 @@ fn test_describe_multiple_commits() {
|
||||||
// Fails if the editor fails
|
// Fails if the editor fails
|
||||||
std::fs::write(&edit_script, "fail").unwrap();
|
std::fs::write(&edit_script, "fail").unwrap();
|
||||||
let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "@", "@-"]);
|
let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "@", "@-"]);
|
||||||
assert!(stderr.contains("exited with an error"));
|
insta::with_settings!({
|
||||||
|
filters => [(r"\bEditor '[^']*'", "Editor '<redacted>'")],
|
||||||
|
}, {
|
||||||
|
insta::assert_snapshot!(stderr, @"Error: Editor '<redacted>' exited with an error");
|
||||||
|
});
|
||||||
|
|
||||||
// describe lines should take priority over ignore-rest
|
// describe lines should take priority over ignore-rest
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
|
|
Loading…
Reference in a new issue