diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index bc7738d08b..8429f9719f 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -728,7 +728,7 @@ impl AdvanceBookmarksSettings { .into_iter() .map(|s| { StringPattern::parse(&s).map_err(|e| { - config_error_with_message(format!("Error parsing '{s}' for {name}"), e) + config_error_with_message(format!("Error parsing `{s}` for {name}"), e) }) }) .collect(), @@ -2875,7 +2875,7 @@ pub fn load_template_aliases( if let Err(s) = r { writeln!( ui.warning_default(), - r#"Failed to load "{table_name}.{decl}": {s}"# + "Failed to load `{table_name}.{decl}`: {s}" )?; } } @@ -3330,7 +3330,7 @@ fn resolve_aliases( .collect_vec(); if resolved_aliases.contains(&*alias_name) { return Err(user_error(format!( - r#"Recursive alias definition involving "{alias_name}""# + "Recursive alias definition involving `{alias_name}`" ))); } if let Some(&alias_name) = defined_aliases.get(&*alias_name) { diff --git a/cli/src/command_error.rs b/cli/src/command_error.rs index f3e57cbf1d..bded41a142 100644 --- a/cli/src/command_error.rs +++ b/cli/src/command_error.rs @@ -217,10 +217,7 @@ fn format_similarity_hint>(candidates: &[S]) -> Option { match candidates { [] => None, names => { - let quoted_names = names - .iter() - .map(|s| format!(r#""{}""#, s.as_ref())) - .join(", "); + let quoted_names = names.iter().map(|s| format!("`{}`", s.as_ref())).join(", "); Some(format!("Did you mean {quoted_names}?")) } } @@ -820,7 +817,7 @@ fn revset_parse_error_hint(err: &RevsetParseError) -> Option { op: _, similar_op, description, - } => Some(format!("Did you mean '{similar_op}' for {description}?")), + } => Some(format!("Did you mean `{similar_op}` for {description}?")), RevsetParseErrorKind::NoSuchFunction { name: _, candidates, diff --git a/cli/src/commands/git/mod.rs b/cli/src/commands/git/mod.rs index 844e363417..853b80b2bc 100644 --- a/cli/src/commands/git/mod.rs +++ b/cli/src/commands/git/mod.rs @@ -131,7 +131,7 @@ fn write_repository_level_trunk_alias( file.save()?; writeln!( ui.status(), - r#"Setting the revset alias "trunk()" to "{branch}@{remote}""#, + "Setting the revset alias `trunk()` to `{branch}@{remote}`", )?; Ok(()) } diff --git a/cli/src/revset_util.rs b/cli/src/revset_util.rs index 7803e55531..2bf2b53340 100644 --- a/cli/src/revset_util.rs +++ b/cli/src/revset_util.rs @@ -194,7 +194,7 @@ pub fn load_revset_aliases( if let Err(s) = r { writeln!( ui.warning_default(), - r#"Failed to load "{table_name}.{decl}": {s}"# + "Failed to load `{table_name}.{decl}`: {s}" )?; } } @@ -267,7 +267,7 @@ pub(super) fn evaluate_revset_to_single_commit<'a>( match (iter.next(), iter.next()) { (Some(commit), None) => Ok(commit?), (None, _) => Err(user_error(format!( - r#"Revset "{revision_str}" didn't resolve to any revisions"# + "Revset `{revision_str}` didn't resolve to any revisions" ))), (Some(commit0), Some(commit1)) => { let mut iter = [commit0, commit1].into_iter().chain(iter); @@ -295,7 +295,7 @@ fn format_multiple_revisions_error( ) -> CommandError { assert!(commits.len() >= 2); let mut cmd_err = user_error(format!( - r#"Revset "{revision_str}" resolved to more than one revision"# + "Revset `{revision_str}` resolved to more than one revision" )); let write_commits_summary = |formatter: &mut dyn Formatter| { for commit in commits { @@ -313,7 +313,7 @@ fn format_multiple_revisions_error( cmd_err.add_formatted_hint_with(|formatter| { writeln!( formatter, - r#"The revset "{revision_str}" resolved to these revisions:"# + "The revset `{revision_str}` resolved to these revisions:" )?; write_commits_summary(formatter) }); @@ -339,14 +339,14 @@ fn format_multiple_revisions_error( cmd_err.add_formatted_hint_with(|formatter| { writeln!( formatter, - r#"The revset "{revision_str}" resolved to these revisions:"# + "The revset `{revision_str}` resolved to these revisions:" )?; write_commits_summary(formatter) }); if should_hint_about_all_prefix { cmd_err.add_hint(format!( - "Prefix the expression with 'all:' to allow any number of revisions (i.e. \ - 'all:{revision_str}')." + "Prefix the expression with `all:` to allow any number of revisions (i.e. \ + `all:{revision_str}`)." )); } }; diff --git a/cli/src/template_builder.rs b/cli/src/template_builder.rs index 536e4cb821..21f7a395d2 100644 --- a/cli/src/template_builder.rs +++ b/cli/src/template_builder.rs @@ -738,7 +738,7 @@ fn build_binary_operation<'a, L: TemplateLanguage<'a> + ?Sized>( let lty = lhs.type_name(); let rty = rhs.type_name(); let out = lhs.try_into_eq(rhs).ok_or_else(|| { - let message = format!(r#"Cannot compare expressions of type "{lty}" and "{rty}""#); + let message = format!("Cannot compare expressions of type `{lty}` and `{rty}`"); TemplateParseError::expression(message, span) })?; match op { @@ -753,7 +753,7 @@ fn build_binary_operation<'a, L: TemplateLanguage<'a> + ?Sized>( let lty = lhs.type_name(); let rty = rhs.type_name(); let out = lhs.try_into_cmp(rhs).ok_or_else(|| { - let message = format!(r#"Cannot compare expressions of type "{lty}" and "{rty}""#); + let message = format!("Cannot compare expressions of type `{lty}` and `{rty}`"); TemplateParseError::expression(message, span) })?; match op { @@ -2041,23 +2041,23 @@ mod tests { = expected , `++`, `||`, `&&`, `==`, `!=`, `>=`, `>`, `<=`, or `<` "#); - insta::assert_snapshot!(env.parse_err(r#"foo"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"foo"#), @r" --> 1:1 | 1 | foo | ^-^ | - = Keyword "foo" doesn't exist - "###); + = Keyword `foo` doesn't exist + "); - insta::assert_snapshot!(env.parse_err(r#"foo()"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"foo()"#), @r" --> 1:1 | 1 | foo() | ^-^ | - = Function "foo" doesn't exist - "###); + = Function `foo` doesn't exist + "); insta::assert_snapshot!(env.parse_err(r#"false()"#), @r###" --> 1:1 | @@ -2067,95 +2067,95 @@ mod tests { = Expected identifier "###); - insta::assert_snapshot!(env.parse_err(r#"!foo"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"!foo"#), @r" --> 1:2 | 1 | !foo | ^-^ | - = Keyword "foo" doesn't exist - "###); - insta::assert_snapshot!(env.parse_err(r#"true && 123"#), @r###" + = Keyword `foo` doesn't exist + "); + insta::assert_snapshot!(env.parse_err(r#"true && 123"#), @r" --> 1:9 | 1 | true && 123 | ^-^ | - = Expected expression of type "Boolean", but actual type is "Integer" - "###); - insta::assert_snapshot!(env.parse_err(r#"true == 1"#), @r#" + = Expected expression of type `Boolean`, but actual type is `Integer` + "); + insta::assert_snapshot!(env.parse_err(r#"true == 1"#), @r" --> 1:1 | 1 | true == 1 | ^-------^ | - = Cannot compare expressions of type "Boolean" and "Integer" - "#); - insta::assert_snapshot!(env.parse_err(r#"true != 'a'"#), @r#" + = Cannot compare expressions of type `Boolean` and `Integer` + "); + insta::assert_snapshot!(env.parse_err(r#"true != 'a'"#), @r" --> 1:1 | 1 | true != 'a' | ^---------^ | - = Cannot compare expressions of type "Boolean" and "String" - "#); - insta::assert_snapshot!(env.parse_err(r#"1 == true"#), @r#" + = Cannot compare expressions of type `Boolean` and `String` + "); + insta::assert_snapshot!(env.parse_err(r#"1 == true"#), @r" --> 1:1 | 1 | 1 == true | ^-------^ | - = Cannot compare expressions of type "Integer" and "Boolean" - "#); - insta::assert_snapshot!(env.parse_err(r#"1 != 'a'"#), @r#" + = Cannot compare expressions of type `Integer` and `Boolean` + "); + insta::assert_snapshot!(env.parse_err(r#"1 != 'a'"#), @r" --> 1:1 | 1 | 1 != 'a' | ^------^ | - = Cannot compare expressions of type "Integer" and "String" - "#); - insta::assert_snapshot!(env.parse_err(r#"'a' == true"#), @r#" + = Cannot compare expressions of type `Integer` and `String` + "); + insta::assert_snapshot!(env.parse_err(r#"'a' == true"#), @r" --> 1:1 | 1 | 'a' == true | ^---------^ | - = Cannot compare expressions of type "String" and "Boolean" - "#); - insta::assert_snapshot!(env.parse_err(r#"'a' != 1"#), @r#" + = Cannot compare expressions of type `String` and `Boolean` + "); + insta::assert_snapshot!(env.parse_err(r#"'a' != 1"#), @r" --> 1:1 | 1 | 'a' != 1 | ^------^ | - = Cannot compare expressions of type "String" and "Integer" - "#); + = Cannot compare expressions of type `String` and `Integer` + "); insta::assert_snapshot!(env.parse_err(r#"'a' == label("", "")"#), @r#" --> 1:1 | 1 | 'a' == label("", "") | ^------------------^ | - = Cannot compare expressions of type "String" and "Template" + = Cannot compare expressions of type `String` and `Template` "#); - insta::assert_snapshot!(env.parse_err(r#"'a' > 1"#), @r#" + insta::assert_snapshot!(env.parse_err(r#"'a' > 1"#), @r" --> 1:1 | 1 | 'a' > 1 | ^-----^ | - = Cannot compare expressions of type "String" and "Integer" - "#); + = Cannot compare expressions of type `String` and `Integer` + "); - insta::assert_snapshot!(env.parse_err(r#"description.first_line().foo()"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"description.first_line().foo()"#), @r" --> 1:26 | 1 | description.first_line().foo() | ^-^ | - = Method "foo" doesn't exist for type "String" - "###); + = Method `foo` doesn't exist for type `String` + "); insta::assert_snapshot!(env.parse_err(r#"10000000000000000000"#), @r###" --> 1:1 @@ -2165,83 +2165,83 @@ mod tests { | = Invalid integer literal "###); - insta::assert_snapshot!(env.parse_err(r#"42.foo()"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"42.foo()"#), @r" --> 1:4 | 1 | 42.foo() | ^-^ | - = Method "foo" doesn't exist for type "Integer" - "###); - insta::assert_snapshot!(env.parse_err(r#"(-empty)"#), @r###" + = Method `foo` doesn't exist for type `Integer` + "); + insta::assert_snapshot!(env.parse_err(r#"(-empty)"#), @r" --> 1:3 | 1 | (-empty) | ^---^ | - = Expected expression of type "Integer", but actual type is "Boolean" - "###); + = Expected expression of type `Integer`, but actual type is `Boolean` + "); - insta::assert_snapshot!(env.parse_err(r#"("foo" ++ "bar").baz()"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"("foo" ++ "bar").baz()"#), @r#" --> 1:18 | 1 | ("foo" ++ "bar").baz() | ^-^ | - = Method "baz" doesn't exist for type "Template" - "###); + = Method `baz` doesn't exist for type `Template` + "#); - insta::assert_snapshot!(env.parse_err(r#"description.contains()"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"description.contains()"#), @r" --> 1:22 | 1 | description.contains() | ^ | - = Function "contains": Expected 1 arguments - "###); + = Function `contains`: Expected 1 arguments + "); - insta::assert_snapshot!(env.parse_err(r#"description.first_line("foo")"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"description.first_line("foo")"#), @r#" --> 1:24 | 1 | description.first_line("foo") | ^---^ | - = Function "first_line": Expected 0 arguments - "###); + = Function `first_line`: Expected 0 arguments + "#); - insta::assert_snapshot!(env.parse_err(r#"label()"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"label()"#), @r" --> 1:7 | 1 | label() | ^ | - = Function "label": Expected 2 arguments - "###); - insta::assert_snapshot!(env.parse_err(r#"label("foo", "bar", "baz")"#), @r###" + = Function `label`: Expected 2 arguments + "); + insta::assert_snapshot!(env.parse_err(r#"label("foo", "bar", "baz")"#), @r#" --> 1:7 | 1 | label("foo", "bar", "baz") | ^-----------------^ | - = Function "label": Expected 2 arguments - "###); + = Function `label`: Expected 2 arguments + "#); - insta::assert_snapshot!(env.parse_err(r#"if()"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"if()"#), @r" --> 1:4 | 1 | if() | ^ | - = Function "if": Expected 2 to 3 arguments - "###); - insta::assert_snapshot!(env.parse_err(r#"if("foo", "bar", "baz", "quux")"#), @r###" + = Function `if`: Expected 2 to 3 arguments + "); + insta::assert_snapshot!(env.parse_err(r#"if("foo", "bar", "baz", "quux")"#), @r#" --> 1:4 | 1 | if("foo", "bar", "baz", "quux") | ^-------------------------^ | - = Function "if": Expected 2 to 3 arguments - "###); + = Function `if`: Expected 2 to 3 arguments + "#); insta::assert_snapshot!(env.parse_err(r#"pad_start("foo", fill_char = "bar", "baz")"#), @r#" --> 1:37 @@ -2249,17 +2249,17 @@ mod tests { 1 | pad_start("foo", fill_char = "bar", "baz") | ^---^ | - = Function "pad_start": Positional argument follows keyword argument + = Function `pad_start`: Positional argument follows keyword argument "#); - insta::assert_snapshot!(env.parse_err(r#"if(label("foo", "bar"), "baz")"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"if(label("foo", "bar"), "baz")"#), @r#" --> 1:4 | 1 | if(label("foo", "bar"), "baz") | ^-----------------^ | - = Expected expression of type "Boolean", but actual type is "Template" - "###); + = Expected expression of type `Boolean`, but actual type is `Template` + "#); insta::assert_snapshot!(env.parse_err(r#"|x| description"#), @r###" --> 1:1 @@ -2277,14 +2277,14 @@ mod tests { env.add_keyword("say_hello", || L::wrap_string(Literal("Hello".to_owned()))); insta::assert_snapshot!(env.render_ok(r#"self.say_hello()"#), @"Hello"); - insta::assert_snapshot!(env.parse_err(r#"self"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"self"#), @r" --> 1:1 | 1 | self | ^--^ | - = Expected expression of type "Template", but actual type is "Self" - "###); + = Expected expression of type `Template`, but actual type is `Self` + "); } #[test] @@ -2302,14 +2302,14 @@ mod tests { insta::assert_snapshot!(env.render_ok(r#"if(sl1, true, false)"#), @"true"); // No implicit cast of integer - insta::assert_snapshot!(env.parse_err(r#"if(0, true, false)"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"if(0, true, false)"#), @r" --> 1:4 | 1 | if(0, true, false) | ^ | - = Expected expression of type "Boolean", but actual type is "Integer" - "###); + = Expected expression of type `Boolean`, but actual type is `Integer` + "); // Optional integer can be converted to boolean, and Some(0) is truthy. env.add_keyword("none_i64", || L::wrap_integer_opt(Literal(None))); @@ -2317,22 +2317,22 @@ mod tests { insta::assert_snapshot!(env.render_ok(r#"if(none_i64, true, false)"#), @"false"); insta::assert_snapshot!(env.render_ok(r#"if(some_i64, true, false)"#), @"true"); - insta::assert_snapshot!(env.parse_err(r#"if(label("", ""), true, false)"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"if(label("", ""), true, false)"#), @r#" --> 1:4 | 1 | if(label("", ""), true, false) | ^-----------^ | - = Expected expression of type "Boolean", but actual type is "Template" - "###); - insta::assert_snapshot!(env.parse_err(r#"if(sl0.map(|x| x), true, false)"#), @r###" + = Expected expression of type `Boolean`, but actual type is `Template` + "#); + insta::assert_snapshot!(env.parse_err(r#"if(sl0.map(|x| x), true, false)"#), @r" --> 1:4 | 1 | if(sl0.map(|x| x), true, false) | ^------------^ | - = Expected expression of type "Boolean", but actual type is "ListTemplate" - "###); + = Expected expression of type `Boolean`, but actual type is `ListTemplate` + "); env.add_keyword("empty_email", || { L::wrap_email(Literal(Email("".to_owned()))) @@ -2510,17 +2510,17 @@ mod tests { 1 | "a".lines().filter(|s| s ++ "\n") | ^-------^ | - = Expected expression of type "Boolean", but actual type is "Template" + = Expected expression of type `Boolean`, but actual type is `Template` "#); // Error in lambda expression - insta::assert_snapshot!(env.parse_err(r#""a".lines().map(|s| s.unknown())"#), @r###" + insta::assert_snapshot!(env.parse_err(r#""a".lines().map(|s| s.unknown())"#), @r#" --> 1:23 | 1 | "a".lines().map(|s| s.unknown()) | ^-----^ | - = Method "unknown" doesn't exist for type "String" - "###); + = Method `unknown` doesn't exist for type `String` + "#); // Error in lambda alias env.add_alias("too_many_params", "|x, y| x"); insta::assert_snapshot!(env.parse_err(r#""a".lines().map(too_many_params)"#), @r#" @@ -2529,7 +2529,7 @@ mod tests { 1 | "a".lines().map(too_many_params) | ^-------------^ | - = In alias "too_many_params" + = In alias `too_many_params` --> 1:2 | 1 | |x, y| x @@ -2819,7 +2819,7 @@ mod tests { 1 | t0.format(bad_time_format) | ^-------------^ | - = In alias "bad_time_format" + = In alias `bad_time_format` --> 1:1 | 1 | "%_" diff --git a/cli/src/template_parser.rs b/cli/src/template_parser.rs index 5d5120bec4..8c5c1daebc 100644 --- a/cli/src/template_parser.rs +++ b/cli/src/template_parser.rs @@ -118,33 +118,33 @@ pub struct TemplateParseError { pub enum TemplateParseErrorKind { #[error("Syntax error")] SyntaxError, - #[error(r#"Keyword "{name}" doesn't exist"#)] + #[error("Keyword `{name}` doesn't exist")] NoSuchKeyword { name: String, candidates: Vec, }, - #[error(r#"Function "{name}" doesn't exist"#)] + #[error("Function `{name}` doesn't exist")] NoSuchFunction { name: String, candidates: Vec, }, - #[error(r#"Method "{name}" doesn't exist for type "{type_name}""#)] + #[error("Method `{name}` doesn't exist for type `{type_name}`")] NoSuchMethod { type_name: String, name: String, candidates: Vec, }, - #[error(r#"Function "{name}": {message}"#)] + #[error("Function `{name}`: {message}")] InvalidArguments { name: String, message: String }, #[error("Redefinition of function parameter")] RedefinedFunctionParameter, #[error("{0}")] Expression(String), - #[error(r#"In alias "{0}""#)] + #[error("In alias `{0}`")] InAliasExpansion(String), - #[error(r#"In function parameter "{0}""#)] + #[error("In function parameter `{0}`")] InParameterExpansion(String), - #[error(r#"Alias "{0}" expanded recursively"#)] + #[error("Alias `{0}` expanded recursively")] RecursiveAlias(String), } @@ -184,7 +184,7 @@ impl TemplateParseError { pub fn expected_type(expected: &str, actual: &str, span: pest::Span<'_>) -> Self { let message = - format!(r#"Expected expression of type "{expected}", but actual type is "{actual}""#); + format!("Expected expression of type `{expected}`, but actual type is `{actual}`"); TemplateParseError::expression(message, span) } diff --git a/cli/tests/test_alias.rs b/cli/tests/test_alias.rs index 9df8a06162..f1461eb1cc 100644 --- a/cli/tests/test_alias.rs +++ b/cli/tests/test_alias.rs @@ -162,14 +162,10 @@ fn test_alias_recursive() { ); // Alias should not cause infinite recursion or hang let stderr = test_env.jj_cmd_failure(&repo_path, &["foo"]); - insta::assert_snapshot!(stderr, @r###" - Error: Recursive alias definition involving "foo" - "###); + insta::assert_snapshot!(stderr, @"Error: Recursive alias definition involving `foo`"); // Also test with mutual recursion let stderr = test_env.jj_cmd_failure(&repo_path, &["bar"]); - insta::assert_snapshot!(stderr, @r###" - Error: Recursive alias definition involving "bar" - "###); + insta::assert_snapshot!(stderr, @"Error: Recursive alias definition involving `bar`"); } #[test] diff --git a/cli/tests/test_bookmark_command.rs b/cli/tests/test_bookmark_command.rs index 6d89338258..72e0200211 100644 --- a/cli/tests/test_bookmark_command.rs +++ b/cli/tests/test_bookmark_command.rs @@ -630,12 +630,12 @@ fn test_bookmark_delete_glob() { // Unknown pattern kind let stderr = test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "forget", "whatever:bookmark"]); - insta::assert_snapshot!(stderr, @r###" - error: invalid value 'whatever:bookmark' for '...': Invalid string pattern kind "whatever:" + insta::assert_snapshot!(stderr, @r" + error: invalid value 'whatever:bookmark' for '...': Invalid string pattern kind `whatever:` For more information, try '--help'. Hint: Try prefixing with one of `exact:`, `glob:`, `regex:`, or `substring:` - "###); + "); } #[test] @@ -688,9 +688,7 @@ fn test_bookmark_forget_export() { // the corresponding git-tracking bookmark. insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @""); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r=foo", "--no-graph"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revision "foo" doesn't exist - "###); + insta::assert_snapshot!(stderr, @"Error: Revision `foo` doesn't exist"); // `jj git export` will delete the bookmark from git. In a colocated repo, // this will happen automatically immediately after a `jj bookmark forget`. @@ -1585,10 +1583,10 @@ fn test_bookmark_list_filtered() { let (stdout, stderr) = query(&["-rbookmarks(remote-delete)"]); insta::assert_snapshot!(stdout, @r###" "###); - insta::assert_snapshot!(query_error(&["-rremote-delete"]), @r###" - Error: Revision "remote-delete" doesn't exist - Hint: Did you mean "remote-delete@origin", "remote-keep", "remote-rewrite", "remote-rewrite@origin"? - "###); + insta::assert_snapshot!(query_error(&["-rremote-delete"]), @r" + Error: Revision `remote-delete` doesn't exist + Hint: Did you mean `remote-delete@origin`, `remote-keep`, `remote-rewrite`, `remote-rewrite@origin`? + "); insta::assert_snapshot!(stderr, @""); // Name patterns are OR-ed. diff --git a/cli/tests/test_commit_template.rs b/cli/tests/test_commit_template.rs index 7297d08455..920542ed73 100644 --- a/cli/tests/test_commit_template.rs +++ b/cli/tests/test_commit_template.rs @@ -67,28 +67,28 @@ fn test_log_parents() { // Commit object isn't printable let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-T", "parents"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse template: Expected expression of type "Template", but actual type is "List" + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse template: Expected expression of type `Template`, but actual type is `List` Caused by: --> 1:1 | 1 | parents | ^-----^ | - = Expected expression of type "Template", but actual type is "List" - "###); + = Expected expression of type `Template`, but actual type is `List` + "); // Redundant argument passed to keyword method let template = r#"parents.map(|c| c.commit_id(""))"#; let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-T", template]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse template: Function "commit_id": Expected 0 arguments + insta::assert_snapshot!(stderr, @r#" + Error: Failed to parse template: Function `commit_id`: Expected 0 arguments Caused by: --> 1:29 | 1 | parents.map(|c| c.commit_id("")) | ^^ | - = Function "commit_id": Expected 0 arguments - "###); + = Function `commit_id`: Expected 0 arguments + "#); } #[test] @@ -813,20 +813,20 @@ fn test_log_immutable() { test_env.add_config("revset-aliases.'immutable_heads()' = 'unknown_fn()'"); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r::", "-T", template]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Config error: Invalid `revset-aliases.immutable_heads()` Caused by: --> 1:1 | 1 | unknown_fn() | ^--------^ | - = Function "unknown_fn" doesn't exist + = Function `unknown_fn` doesn't exist For help, see https://jj-vcs.github.io/jj/latest/config/. - "#); + "); test_env.add_config("revset-aliases.'immutable_heads()' = 'unknown_symbol'"); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r::", "-T", template]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Error: Failed to parse template: Failed to evaluate revset Caused by: 1: --> 5:10 @@ -835,8 +835,8 @@ fn test_log_immutable() { | ^-------^ | = Failed to evaluate revset - 2: Revision "unknown_symbol" doesn't exist - "###); + 2: Revision `unknown_symbol` doesn't exist + "#); } #[test] @@ -917,7 +917,7 @@ fn test_log_contained_in() { 1 | unknown_fn() | ^--------^ | - = Function "unknown_fn" doesn't exist + = Function `unknown_fn` doesn't exist "#); let stderr = test_env.jj_cmd_failure( @@ -939,7 +939,7 @@ fn test_log_contained_in() { | ^---^ | = Invalid string pattern - 3: Invalid string pattern kind "x:" + 3: Invalid string pattern kind `x:` Hint: Try prefixing with one of `exact:`, `glob:`, `regex:`, or `substring:` "#); @@ -947,7 +947,7 @@ fn test_log_contained_in() { &repo_path, &["log", "-r::", "-T", &template_for_revset("maine")], ); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Error: Failed to parse template: Failed to evaluate revset Caused by: 1: --> 5:28 @@ -956,9 +956,9 @@ fn test_log_contained_in() { | ^-----^ | = Failed to evaluate revset - 2: Revision "maine" doesn't exist - Hint: Did you mean "main"? - "###); + 2: Revision `maine` doesn't exist + Hint: Did you mean `main`? + "#); } #[test] diff --git a/cli/tests/test_git_clone.rs b/cli/tests/test_git_clone.rs index da191cea8e..c0e5bb6081 100644 --- a/cli/tests/test_git_clone.rs +++ b/cli/tests/test_git_clone.rs @@ -83,14 +83,14 @@ fn test_git_clone(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone" bookmark: main@origin [new] tracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: uuqppmxq 1f0b881a (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message Added 1 files, modified 0 files, removed 0 files - "###); + "#); } assert!(test_env.env_root().join("clone").join("file").exists()); @@ -201,14 +201,14 @@ fn test_git_clone(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/nested/path/to/repo" bookmark: main@origin [new] tracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: uuzqqzqu df8acbac (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message Added 1 files, modified 0 files, removed 0 files - "###); + "#); } } @@ -286,14 +286,14 @@ fn test_git_clone_colocate(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone" bookmark: main@origin [new] tracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: uuqppmxq 1f0b881a (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message Added 1 files, modified 0 files, removed 0 files - "###); + "#); } assert!(test_env.env_root().join("clone").join("file").exists()); assert!(test_env.env_root().join("clone").join(".git").exists()); @@ -474,14 +474,14 @@ fn test_git_clone_colocate(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/nested/path/to/repo" bookmark: main@origin [new] tracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: vzqnnsmr 9407107f (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message Added 1 files, modified 0 files, removed 0 files - "###); + "#); } } @@ -510,15 +510,15 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) { let (_stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["git", "clone", "source", "clone1"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone1" bookmark: feature1@origin [new] tracked bookmark: main@origin [new] tracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: sqpuoqvx cad212e1 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 feature1 main | message Added 1 files, modified 0 files, removed 0 files - "###); + "#); } insta::allow_duplicates! { insta::assert_snapshot!( @@ -546,15 +546,15 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) { let (_stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["git", "clone", "source", "clone2"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone2" bookmark: feature1@origin [new] untracked bookmark: main@origin [new] untracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: rzvqmyuk cc8a5041 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 feature1@origin main | message Added 1 files, modified 0 files, removed 0 files - "###); + "#); } insta::allow_duplicates! { insta::assert_snapshot!( @@ -570,15 +570,15 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) { let (_stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["git", "clone", "source", "clone3"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone3" bookmark: feature1@origin [new] untracked bookmark: main@origin [new] untracked - Setting the revset alias "trunk()" to "feature1@origin" + Setting the revset alias `trunk()` to `feature1@origin` Working copy now at: nppvrztz b8a8a17b (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 feature1 main@origin | message Added 1 files, modified 0 files, removed 0 files - "###); + "#); } insta::allow_duplicates! { insta::assert_snapshot!( @@ -627,7 +627,7 @@ fn test_git_clone_remote_default_bookmark_with_escape(subprocess: bool) { insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone" bookmark: "@origin [new] untracked - Setting the revset alias "trunk()" to ""\""@origin" + Setting the revset alias `trunk()` to `"\""@origin` Working copy now at: sqpuoqvx cad212e1 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 " | message Added 1 files, modified 0 files, removed 0 files @@ -661,11 +661,11 @@ fn test_git_clone_ignore_working_copy(subprocess: bool) { &["git", "clone", "--ignore-working-copy", "source", "clone"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone" bookmark: main@origin [new] untracked - Setting the revset alias "trunk()" to "main@origin" - "###); + Setting the revset alias `trunk()` to `main@origin` + "#); } let clone_path = test_env.env_root().join("clone"); @@ -738,7 +738,7 @@ fn test_git_clone_with_remote_name(subprocess: bool) { insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone" bookmark: main@upstream [new] tracked - Setting the revset alias "trunk()" to "main@upstream" + Setting the revset alias `trunk()` to `main@upstream` Working copy now at: sqpuoqvx cad212e1 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message Added 1 files, modified 0 files, removed 0 files @@ -786,7 +786,7 @@ fn test_git_clone_trunk_deleted(subprocess: bool) { insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone" bookmark: main@origin [new] untracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: sqpuoqvx cad212e1 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message Added 1 files, modified 0 files, removed 0 files @@ -798,11 +798,11 @@ fn test_git_clone_trunk_deleted(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Forgot 1 bookmarks. - Warning: Failed to resolve `revset-aliases.trunk()`: Revision "main@origin" doesn't exist + Warning: Failed to resolve `revset-aliases.trunk()`: Revision `main@origin` doesn't exist Hint: Use `jj config edit --repo` to adjust the `trunk()` alias. - "#); + "); } let (stdout, stderr) = test_env.jj_cmd_ok(&clone_path, &["log"]); @@ -816,10 +816,10 @@ fn test_git_clone_trunk_deleted(subprocess: bool) { "#); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" - Warning: Failed to resolve `revset-aliases.trunk()`: Revision "main@origin" doesn't exist + insta::assert_snapshot!(stderr, @r" + Warning: Failed to resolve `revset-aliases.trunk()`: Revision `main@origin` doesn't exist Hint: Use `jj config edit --repo` to adjust the `trunk()` alias. - "#); + "); } } @@ -881,7 +881,7 @@ fn test_git_clone_conditional_config() { insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/new" bookmark: main@origin [new] untracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: zxsnswpr 5695b5e5 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message Added 1 files, modified 0 files, removed 0 files @@ -947,7 +947,7 @@ fn test_git_clone_with_depth_subprocess() { insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone" bookmark: main@origin [new] tracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Working copy now at: sqpuoqvx cad212e1 (empty) (no description set) Parent commit : mzyxwzks 9f01a0e0 main | message Added 1 files, modified 0 files, removed 0 files @@ -987,7 +987,7 @@ fn test_git_clone_invalid_immutable_heads(subprocess: bool) { Fetching into new repo in "$TEST_ENV/clone" bookmark: main@origin [new] untracked Config error: Invalid `revset-aliases.immutable_heads()` - Caused by: Revision "unknown" doesn't exist + Caused by: Revision `unknown` doesn't exist For help, see https://jj-vcs.github.io/jj/latest/config/. "#); } @@ -1014,7 +1014,7 @@ fn test_git_clone_malformed(subprocess: bool) { insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/clone" bookmark: main@origin [new] untracked - Setting the revset alias "trunk()" to "main@origin" + Setting the revset alias `trunk()` to `main@origin` Internal error: Failed to check out commit 039a1eae03465fd3be0fbad87c9ca97303742677 Caused by: Reserved path component .jj in $TEST_ENV/clone/.jj "#); diff --git a/cli/tests/test_git_colocated.rs b/cli/tests/test_git_colocated.rs index dde0c23bbc..cadff9e35b 100644 --- a/cli/tests/test_git_colocated.rs +++ b/cli/tests/test_git_colocated.rs @@ -1269,9 +1269,7 @@ fn test_git_colocated_unreachable_commits() { // Check that trying to look up the second commit fails gracefully let stderr = test_env.jj_cmd_failure(&workspace_root, &["show", &oid2.to_string()]); - insta::assert_snapshot!(stderr, @r###" - Error: Revision "8e713ff77b54928dd4a82aaabeca44b1ae91722c" doesn't exist - "###); + insta::assert_snapshot!(stderr, @"Error: Revision `8e713ff77b54928dd4a82aaabeca44b1ae91722c` doesn't exist"); } fn get_bookmark_output(test_env: &TestEnvironment, repo_path: &Path) -> String { diff --git a/cli/tests/test_git_import_export.rs b/cli/tests/test_git_import_export.rs index a5634c7bc0..a8b88fd1dc 100644 --- a/cli/tests/test_git_import_export.rs +++ b/cli/tests/test_git_import_export.rs @@ -113,10 +113,10 @@ fn test_git_export_undo() { ), ] "###); - insta::assert_snapshot!(test_env.jj_cmd_failure(&repo_path, &["log", "-ra@git"]), @r###" - Error: Revision "a@git" doesn't exist - Hint: Did you mean "a"? - "###); + insta::assert_snapshot!(test_env.jj_cmd_failure(&repo_path, &["log", "-ra@git"]), @r" + Error: Revision `a@git` doesn't exist + Hint: Did you mean `a`? + "); // This would re-export bookmark "a" and create git-tracking bookmark. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); diff --git a/cli/tests/test_git_init.rs b/cli/tests/test_git_init.rs index 6d069a85bd..b81decce86 100644 --- a/cli/tests/test_git_init.rs +++ b/cli/tests/test_git_init.rs @@ -225,14 +225,14 @@ fn test_git_init_external_import_trunk(bare: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. - Setting the revset alias "trunk()" to "trunk@origin" + Setting the revset alias `trunk()` to `trunk@origin` Working copy now at: sqpuoqvx f6950fc1 (empty) (no description set) Parent commit : mwrttmos 8d698d4a my-bookmark trunk@origin | My commit message Added 1 files, modified 0 files, removed 0 files Initialized repo in "repo" - "###); + "#); } // "trunk()" alias should be set to remote "origin"'s default bookmark "trunk" diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index 646b4c733c..de4ce82708 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -810,13 +810,13 @@ fn test_git_push_changes(subprocess: bool) { std::fs::write(workspace_root.join("file"), "modified2").unwrap(); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "-c=(@|@-)"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Revset "(@|@-)" resolved to more than one revision - Hint: The revset "(@|@-)" resolved to these revisions: + insta::assert_snapshot!(stderr, @r" + Error: Revset `(@|@-)` resolved to more than one revision + Hint: The revset `(@|@-)` resolved to these revisions: yostqsxw 16c16966 push-yostqsxwqrlt* | bar yqosqzyt a050abf4 foo - Hint: Prefix the expression with 'all:' to allow any number of revisions (i.e. 'all:(@|@-)'). - "###); + Hint: Prefix the expression with `all:` to allow any number of revisions (i.e. `all:(@|@-)`). + "); } // test pushing two changes at once, part 2 let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-c=all:(@|@-)"]); diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index 0c0b85fe4a..ca33b2547b 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -528,13 +528,13 @@ fn test_color_ui_messages() { // formatted hint let stderr = test_env.jj_cmd_failure(&repo_path, &["new", ".."]); - insta::assert_snapshot!(stderr, @r###" - Error: Revset ".." resolved to more than one revision - Hint: The revset ".." resolved to these revisions: + insta::assert_snapshot!(stderr, @r" + Error: Revset `..` resolved to more than one revision + Hint: The revset `..` resolved to these revisions:  mzvwutvl 167f90e7 (empty) (no description set)  qpvuntsm 230dd059 (empty) (no description set) - Hint: Prefix the expression with 'all:' to allow any number of revisions (i.e. 'all:..'). - "###); + Hint: Prefix the expression with `all:` to allow any number of revisions (i.e. `all:..`). + "); // debugging colors let (stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["st", "--color", "debug"]); diff --git a/cli/tests/test_immutable_commits.rs b/cli/tests/test_immutable_commits.rs index 6b52312673..316251b0d1 100644 --- a/cli/tests/test_immutable_commits.rs +++ b/cli/tests/test_immutable_commits.rs @@ -65,11 +65,11 @@ fn test_rewrite_immutable_generic() { // Suppress warning in the commit summary template test_env.add_config("template-aliases.'format_short_id(id)' = 'id.short(8)'"); let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Config error: Invalid `revset-aliases.immutable_heads()` - Caused by: Revision "bookmark_that_does_not_exist" doesn't exist + Caused by: Revision `bookmark_that_does_not_exist` doesn't exist For help, see https://jj-vcs.github.io/jj/latest/config/. - "###); + "); // Can use --ignore-immutable to override test_env.add_config(r#"revset-aliases."immutable_heads()" = "main""#); diff --git a/cli/tests/test_log_command.rs b/cli/tests/test_log_command.rs index 0bdcd82bc4..51e9122b6e 100644 --- a/cli/tests/test_log_command.rs +++ b/cli/tests/test_log_command.rs @@ -472,7 +472,7 @@ fn test_log_bad_short_prefixes() { @ 2 ◆ 0 "#); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: In template expression --> 1:11 | @@ -481,16 +481,16 @@ fn test_log_bad_short_prefixes() { | = Failed to load short-prefixes index Failed to resolve short-prefixes disambiguation revset - Revision "missing" doesn't exist - "#); + Revision `missing` doesn't exist + "); // Error on resolution of short prefixes test_env.add_config("revsets.short-prefixes = 'missing'"); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r0"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Error: Failed to resolve short-prefixes disambiguation revset - Caused by: Revision "missing" doesn't exist - "#); + Caused by: Revision `missing` doesn't exist + "); } #[test] @@ -678,9 +678,7 @@ fn test_log_prefix_highlight_counts_hidden_commits() { ); insta::assert_snapshot!( test_env.jj_cmd_failure(&repo_path, &["log", "-r", "4", "-T", prefix_format]), - @r###" - Error: Commit ID prefix "4" is ambiguous - "### + @"Error: Commit ID prefix `4` is ambiguous" ); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["log", "-r", "44", "-T", prefix_format]), diff --git a/cli/tests/test_new_command.rs b/cli/tests/test_new_command.rs index e892a48e8d..2855defa8e 100644 --- a/cli/tests/test_new_command.rs +++ b/cli/tests/test_new_command.rs @@ -120,9 +120,7 @@ fn test_new_merge() { // merge with non-unique revisions let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "@", "3a44e"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revision "3a44e" doesn't exist - "###); + insta::assert_snapshot!(stderr, @"Error: Revision `3a44e` doesn't exist"); // if prefixed with all:, duplicates are allowed let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["new", "@", "all:visible_heads()"]); insta::assert_snapshot!(stdout, @""); @@ -627,14 +625,14 @@ fn test_new_conflicting_bookmarks() { test_env.jj_cmd_ok(&repo_path, &["st"]); let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revset "foo" resolved to more than one revision + insta::assert_snapshot!(stderr, @r" + Error: Revset `foo` resolved to more than one revision Hint: Bookmark foo resolved to multiple revisions because it's conflicted. It resolved to these revisions: kkmpptxz 66c6502d foo?? | (empty) two qpvuntsm 876f4b7e foo?? | (empty) one Hint: Set which revision the bookmark points to with `jj bookmark set foo -r `. - "###); + "); } #[test] @@ -650,13 +648,13 @@ fn test_new_conflicting_change_ids() { test_env.jj_cmd_ok(&repo_path, &["st"]); let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "qpvuntsm"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revset "qpvuntsm" resolved to more than one revision - Hint: The revset "qpvuntsm" resolved to these revisions: + insta::assert_snapshot!(stderr, @r" + Error: Revset `qpvuntsm` resolved to more than one revision + Hint: The revset `qpvuntsm` resolved to these revisions: qpvuntsm?? 66c6502d (empty) two qpvuntsm?? 876f4b7e (empty) one Hint: Some of these commits have the same change id. Abandon one of them with `jj abandon -r `. - "###); + "); } #[test] @@ -669,9 +667,7 @@ fn test_new_error_revision_does_not_exist() { test_env.jj_cmd_ok(&repo_path, &["new", "-m", "two"]); let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "this"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revision "this" doesn't exist - "###); + insta::assert_snapshot!(stderr, @"Error: Revision `this` doesn't exist"); } fn setup_before_insertion(test_env: &TestEnvironment, repo_path: &Path) { diff --git a/cli/tests/test_rebase_command.rs b/cli/tests/test_rebase_command.rs index 130499d099..d586c79a3a 100644 --- a/cli/tests/test_rebase_command.rs +++ b/cli/tests/test_rebase_command.rs @@ -129,9 +129,9 @@ fn test_rebase_empty_sets() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @"Nothing changed."); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-s=none()", "-d=b"]); - insta::assert_snapshot!(stderr, @r###"Error: Revset "none()" didn't resolve to any revisions"###); + insta::assert_snapshot!(stderr, @"Error: Revset `none()` didn't resolve to any revisions"); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-b=none()", "-d=b"]); - insta::assert_snapshot!(stderr, @r###"Error: Revset "none()" didn't resolve to any revisions"###); + insta::assert_snapshot!(stderr, @"Error: Revset `none()` didn't resolve to any revisions"); // Empty because "b..a" is empty let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-b=a", "-d=b"]); insta::assert_snapshot!(stdout, @""); @@ -199,13 +199,13 @@ fn test_rebase_bookmark() { // Same test but with more than one revision per argument test_env.jj_cmd_ok(&repo_path, &["undo"]); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-b=e|d", "-d=b"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revset "e|d" resolved to more than one revision - Hint: The revset "e|d" resolved to these revisions: + insta::assert_snapshot!(stderr, @r" + Error: Revset `e|d` resolved to more than one revision + Hint: The revset `e|d` resolved to these revisions: znkkpsqq e52756c8 e | e vruxwmqv 514fa6b2 d | d - Hint: Prefix the expression with 'all:' to allow any number of revisions (i.e. 'all:e|d'). - "###); + Hint: Prefix the expression with `all:` to allow any number of revisions (i.e. `all:e|d`). + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-b=all:e|d", "-d=b"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r#" @@ -714,13 +714,13 @@ fn test_rebase_multiple_destinations() { "###); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-r", "a", "-d", "b|c"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revset "b|c" resolved to more than one revision - Hint: The revset "b|c" resolved to these revisions: + insta::assert_snapshot!(stderr, @r" + Error: Revset `b|c` resolved to more than one revision + Hint: The revset `b|c` resolved to these revisions: royxmykx fe2e8e8b c | c zsuskuln d370aee1 b | b - Hint: Prefix the expression with 'all:' to allow any number of revisions (i.e. 'all:b|c'). - "###); + Hint: Prefix the expression with `all:` to allow any number of revisions (i.e. `all:b|c`). + "); // try with 'all:' and succeed let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "a", "-d", "all:b|c"]); @@ -873,13 +873,13 @@ fn test_rebase_with_descendants() { // Same test as above, but with multiple commits per argument test_env.jj_cmd_ok(&repo_path, &["undo"]); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-s=b|d", "-d=a"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revset "b|d" resolved to more than one revision - Hint: The revset "b|d" resolved to these revisions: + insta::assert_snapshot!(stderr, @r" + Error: Revset `b|d` resolved to more than one revision + Hint: The revset `b|d` resolved to these revisions: vruxwmqv df54a9fd d | d zsuskuln d370aee1 b | b - Hint: Prefix the expression with 'all:' to allow any number of revisions (i.e. 'all:b|d'). - "###); + Hint: Prefix the expression with `all:` to allow any number of revisions (i.e. `all:b|d`). + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-s=all:b|d", "-d=a"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @r#" @@ -910,14 +910,10 @@ fn test_rebase_error_revision_does_not_exist() { test_env.jj_cmd_ok(&repo_path, &["new", "-r", "@-", "-m", "two"]); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-b", "b-one", "-d", "this"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revision "this" doesn't exist - "###); + insta::assert_snapshot!(stderr, @"Error: Revision `this` doesn't exist"); let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-b", "this", "-d", "b-one"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revision "this" doesn't exist - "###); + insta::assert_snapshot!(stderr, @"Error: Revision `this` doesn't exist"); } // This behavior illustrates https://github.com/jj-vcs/jj/issues/2600 diff --git a/cli/tests/test_revset_output.rs b/cli/tests/test_revset_output.rs index 2aa19a9ac8..551ef0fbf7 100644 --- a/cli/tests/test_revset_output.rs +++ b/cli/tests/test_revset_output.rs @@ -21,16 +21,16 @@ fn test_syntax_error() { let repo_path = test_env.env_root().join("repo"); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", ":x"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: ':' is not a prefix operator + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: `:` is not a prefix operator Caused by: --> 1:1 | 1 | :x | ^ | - = ':' is not a prefix operator - Hint: Did you mean '::' for ancestors? - "###); + = `:` is not a prefix operator + Hint: Did you mean `::` for ancestors? + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "x &"]); insta::assert_snapshot!(stderr, @r###" @@ -44,28 +44,28 @@ fn test_syntax_error() { "###); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "x - y"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: '-' is not an infix operator + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: `-` is not an infix operator Caused by: --> 1:3 | 1 | x - y | ^ | - = '-' is not an infix operator - Hint: Did you mean '~' for difference? - "###); + = `-` is not an infix operator + Hint: Did you mean `~` for difference? + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "HEAD^"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: '^' is not a postfix operator + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: `^` is not a postfix operator Caused by: --> 1:5 | 1 | HEAD^ | ^ | - = '^' is not a postfix operator - Hint: Did you mean '-' for parents? - "###); + = `^` is not a postfix operator + Hint: Did you mean `-` for parents? + "); } #[test] @@ -75,48 +75,48 @@ fn test_bad_function_call() { let repo_path = test_env.env_root().join("repo"); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "all(or::nothing)"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "all": Expected 0 arguments + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Function `all`: Expected 0 arguments Caused by: --> 1:5 | 1 | all(or::nothing) | ^---------^ | - = Function "all": Expected 0 arguments - "###); + = Function `all`: Expected 0 arguments + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "parents()"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "parents": Expected 1 arguments + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Function `parents`: Expected 1 arguments Caused by: --> 1:9 | 1 | parents() | ^ | - = Function "parents": Expected 1 arguments - "###); + = Function `parents`: Expected 1 arguments + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "parents(foo, bar)"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "parents": Expected 1 arguments + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Function `parents`: Expected 1 arguments Caused by: --> 1:9 | 1 | parents(foo, bar) | ^------^ | - = Function "parents": Expected 1 arguments - "###); + = Function `parents`: Expected 1 arguments + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "heads(foo, bar)"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "heads": Expected 1 arguments + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Function `heads`: Expected 1 arguments Caused by: --> 1:7 | 1 | heads(foo, bar) | ^------^ | - = Function "heads": Expected 1 arguments - "###); + = Function `heads`: Expected 1 arguments + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "latest(a, not_an_integer)"]); insta::assert_snapshot!(stderr, @r###" @@ -130,15 +130,15 @@ fn test_bad_function_call() { "###); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "files()"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "files": Expected at least 1 arguments + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Function `files`: Expected at least 1 arguments Caused by: --> 1:7 | 1 | files() | ^ | - = Function "files": Expected at least 1 arguments - "###); + = Function `files`: Expected at least 1 arguments + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "files(not::a-fileset)"]); insta::assert_snapshot!(stderr, @r#" @@ -160,7 +160,7 @@ fn test_bad_function_call() { "#); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", r#"files(foo:"bar")"#]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Error: Failed to parse revset: In fileset expression Caused by: 1: --> 1:7 @@ -175,8 +175,8 @@ fn test_bad_function_call() { | ^-------^ | = Invalid file pattern - 3: Invalid file pattern kind "foo:" - "###); + 3: Invalid file pattern kind `foo:` + "#); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", r#"files(a, "../out")"#]); insta::assert_snapshot!(stderr.replace('\\', "/"), @r###" @@ -199,7 +199,7 @@ fn test_bad_function_call() { "###); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "bookmarks(bad:pattern)"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Failed to parse revset: Invalid string pattern Caused by: 1: --> 1:11 @@ -208,9 +208,9 @@ fn test_bad_function_call() { | ^---------^ | = Invalid string pattern - 2: Invalid string pattern kind "bad:" + 2: Invalid string pattern kind `bad:` Hint: Try prefixing with one of `exact:`, `glob:`, `regex:`, or `substring:` - "###); + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "bookmarks(regex:'(')"]); insta::assert_snapshot!(stderr, @r###" @@ -229,41 +229,41 @@ fn test_bad_function_call() { "###); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "root()::whatever()"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "whatever" doesn't exist + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Function `whatever` doesn't exist Caused by: --> 1:9 | 1 | root()::whatever() | ^------^ | - = Function "whatever" doesn't exist - "###); + = Function `whatever` doesn't exist + "); let stderr = test_env.jj_cmd_failure( &repo_path, &["log", "-r", "remote_bookmarks(a, b, remote=c)"], ); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "remote_bookmarks": Got multiple values for keyword "remote" + insta::assert_snapshot!(stderr, @r#" + Error: Failed to parse revset: Function `remote_bookmarks`: Got multiple values for keyword "remote" Caused by: --> 1:24 | 1 | remote_bookmarks(a, b, remote=c) | ^------^ | - = Function "remote_bookmarks": Got multiple values for keyword "remote" - "###); + = Function `remote_bookmarks`: Got multiple values for keyword "remote" + "#); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "remote_bookmarks(remote=a, b)"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "remote_bookmarks": Positional argument follows keyword argument + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Function `remote_bookmarks`: Positional argument follows keyword argument Caused by: --> 1:28 | 1 | remote_bookmarks(remote=a, b) | ^ | - = Function "remote_bookmarks": Positional argument follows keyword argument - "###); + = Function `remote_bookmarks`: Positional argument follows keyword argument + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "remote_bookmarks(=foo)"]); insta::assert_snapshot!(stderr, @r" @@ -366,46 +366,46 @@ fn test_function_name_hint() { ); // The suggestion "bookmarks" shouldn't be duplicated - insta::assert_snapshot!(evaluate_err("bookmark()"), @r###" - Error: Failed to parse revset: Function "bookmark" doesn't exist + insta::assert_snapshot!(evaluate_err("bookmark()"), @r" + Error: Failed to parse revset: Function `bookmark` doesn't exist Caused by: --> 1:1 | 1 | bookmark() | ^------^ | - = Function "bookmark" doesn't exist - Hint: Did you mean "bookmarks", "remote_bookmarks"? - "###); + = Function `bookmark` doesn't exist + Hint: Did you mean `bookmarks`, `remote_bookmarks`? + "); // Both builtin function and function alias should be suggested - insta::assert_snapshot!(evaluate_err("author_()"), @r#" - Error: Failed to parse revset: Function "author_" doesn't exist + insta::assert_snapshot!(evaluate_err("author_()"), @r" + Error: Failed to parse revset: Function `author_` doesn't exist Caused by: --> 1:1 | 1 | author_() | ^-----^ | - = Function "author_" doesn't exist - Hint: Did you mean "author", "author_date", "author_email", "author_name", "my_author"? - "#); + = Function `author_` doesn't exist + Hint: Did you mean `author`, `author_date`, `author_email`, `author_name`, `my_author`? + "); - insta::assert_snapshot!(evaluate_err("my_bookmarks"), @r#" - Error: Failed to parse revset: In alias "my_bookmarks" + insta::assert_snapshot!(evaluate_err("my_bookmarks"), @r" + Error: Failed to parse revset: In alias `my_bookmarks` Caused by: 1: --> 1:1 | 1 | my_bookmarks | ^----------^ | - = In alias "my_bookmarks" + = In alias `my_bookmarks` 2: --> 1:1 | 1 | bookmark() | ^------^ | - = Function "bookmark" doesn't exist - Hint: Did you mean "bookmarks", "remote_bookmarks"? - "#); + = Function `bookmark` doesn't exist + Hint: Did you mean `bookmarks`, `remote_bookmarks`? + "); } #[test] @@ -439,122 +439,122 @@ fn test_alias() { "###); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "root() & syntax-error"]); - insta::assert_snapshot!(stderr, @r#" - Error: Failed to parse revset: In alias "syntax-error" + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: In alias `syntax-error` Caused by: 1: --> 1:10 | 1 | root() & syntax-error | ^----------^ | - = In alias "syntax-error" + = In alias `syntax-error` 2: --> 1:11 | 1 | whatever & | ^--- | = expected `::`, `..`, `~`, or - "#); + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "identity()"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Function "identity": Expected 1 arguments + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Function `identity`: Expected 1 arguments Caused by: --> 1:10 | 1 | identity() | ^ | - = Function "identity": Expected 1 arguments - "###); + = Function `identity`: Expected 1 arguments + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "my_author(none())"]); - insta::assert_snapshot!(stderr, @r#" - Error: Failed to parse revset: In alias "my_author(x)" + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: In alias `my_author(x)` Caused by: 1: --> 1:1 | 1 | my_author(none()) | ^---------------^ | - = In alias "my_author(x)" + = In alias `my_author(x)` 2: --> 1:8 | 1 | author(x) | ^ | - = In function parameter "x" + = In function parameter `x` 3: --> 1:11 | 1 | my_author(none()) | ^----^ | = Expected expression of string pattern - "#); + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-r", "root() & recurse"]); - insta::assert_snapshot!(stderr, @r#" - Error: Failed to parse revset: In alias "recurse" + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: In alias `recurse` Caused by: 1: --> 1:10 | 1 | root() & recurse | ^-----^ | - = In alias "recurse" + = In alias `recurse` 2: --> 1:1 | 1 | recurse1 | ^------^ | - = In alias "recurse1" + = In alias `recurse1` 3: --> 1:1 | 1 | recurse2() | ^--------^ | - = In alias "recurse2()" + = In alias `recurse2()` 4: --> 1:1 | 1 | recurse | ^-----^ | - = Alias "recurse" expanded recursively - "#); + = Alias `recurse` expanded recursively + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "-r", "deprecated()"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: In revset expression --> 1:1 | 1 | deprecated() | ^----------^ | - = In alias "deprecated()" + = In alias `deprecated()` --> 1:1 | 1 | branches() | ^------^ | = branches() is deprecated; use bookmarks() instead - "#); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "-r", "all:deprecated()"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: In revset expression --> 1:5 | 1 | all:deprecated() | ^----------^ | - = In alias "deprecated()" + = In alias `deprecated()` --> 1:1 | 1 | branches() | ^------^ | = branches() is deprecated; use bookmarks() instead - "#); + "); } #[test] @@ -576,9 +576,7 @@ fn test_alias_override() { &repo_path, &["log", "-r", "f(_)", "--config=revset-aliases.'f(a)'=arg"], ); - insta::assert_snapshot!(stderr, @r###" - Error: Revision "arg" doesn't exist - "###); + insta::assert_snapshot!(stderr, @"Error: Revision `arg` doesn't exist"); } #[test] @@ -602,13 +600,13 @@ fn test_bad_alias_decl() { ◆ zzzzzzzz root() 00000000 "###); insta::assert_snapshot!(stderr, @r#" - Warning: Failed to load "revset-aliases."bad"": --> 1:1 + Warning: Failed to load `revset-aliases."bad"`: --> 1:1 | 1 | "bad" | ^--- | = expected or - Warning: Failed to load "revset-aliases.badfn(a, a)": --> 1:7 + Warning: Failed to load `revset-aliases.badfn(a, a)`: --> 1:7 | 1 | badfn(a, a) | ^--^ @@ -625,13 +623,13 @@ fn test_all_modifier() { // Command that accepts single revision by default let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "all()"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revset "all()" resolved to more than one revision - Hint: The revset "all()" resolved to these revisions: + insta::assert_snapshot!(stderr, @r" + Error: Revset `all()` resolved to more than one revision + Hint: The revset `all()` resolved to these revisions: qpvuntsm 230dd059 (empty) (no description set) zzzzzzzz 00000000 (empty) (no description set) - Hint: Prefix the expression with 'all:' to allow any number of revisions (i.e. 'all:all()'). - "###); + Hint: Prefix the expression with `all:` to allow any number of revisions (i.e. `all:all()`). + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "all:all()"]); insta::assert_snapshot!(stderr, @r###" Error: The Git backend does not support creating merge commits with the root commit as one of the parents. @@ -651,12 +649,12 @@ fn test_all_modifier() { Created 1 bookmarks pointing to qpvuntsm 230dd059 x | (empty) (no description set) "###); let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "set", "-rall:all()", "x"]); - insta::assert_snapshot!(stderr, @r###" - Error: Revset "all:all()" resolved to more than one revision - Hint: The revset "all:all()" resolved to these revisions: + insta::assert_snapshot!(stderr, @r" + Error: Revset `all:all()` resolved to more than one revision + Hint: The revset `all:all()` resolved to these revisions: qpvuntsm 230dd059 x | (empty) (no description set) zzzzzzzz 00000000 (empty) (no description set) - "###); + "); // Template expression that accepts multiple revisions by default let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-Tself.contained_in('all:all()')"]); @@ -667,37 +665,37 @@ fn test_all_modifier() { // Typo let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "ale:x"]); - insta::assert_snapshot!(stderr, @r###" - Error: Failed to parse revset: Modifier "ale" doesn't exist + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: Modifier `ale` doesn't exist Caused by: --> 1:1 | 1 | ale:x | ^-^ | - = Modifier "ale" doesn't exist - "###); + = Modifier `ale` doesn't exist + "); // Modifier shouldn't be allowed in sub expression let stderr = test_env.jj_cmd_failure( &repo_path, &["new", "x..", "--config=revset-aliases.x='all:@'"], ); - insta::assert_snapshot!(stderr, @r#" - Error: Failed to parse revset: In alias "x" + insta::assert_snapshot!(stderr, @r" + Error: Failed to parse revset: In alias `x` Caused by: 1: --> 1:1 | 1 | x.. | ^ | - = In alias "x" + = In alias `x` 2: --> 1:1 | 1 | all:@ | ^-^ | - = Modifier "all:" is not allowed in sub expression - "#); + = Modifier `all:` is not allowed in sub expression + "); // immutable_heads() alias may be parsed as a top-level expression, but // still, modifier shouldn't be allowed there. @@ -709,16 +707,16 @@ fn test_all_modifier() { "--config=revsets.short-prefixes='none()'", ], ); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Config error: Invalid `revset-aliases.immutable_heads()` Caused by: --> 1:1 | 1 | all:@ | ^-^ | - = Modifier "all:" is not allowed in sub expression + = Modifier `all:` is not allowed in sub expression For help, see https://jj-vcs.github.io/jj/latest/config/. - "###); + "); } /// Verifies that the committer_date revset honors the local time zone. diff --git a/cli/tests/test_templater.rs b/cli/tests/test_templater.rs index 5cea472da4..1fdeb600db 100644 --- a/cli/tests/test_templater.rs +++ b/cli/tests/test_templater.rs @@ -45,76 +45,76 @@ fn test_templater_parse_error() { 'format_id(id)' = 'id.sort()' "###, ); - insta::assert_snapshot!(render_err(r#"conflicts"#), @r###" - Error: Failed to parse template: Keyword "conflicts" doesn't exist + insta::assert_snapshot!(render_err(r#"conflicts"#), @r" + Error: Failed to parse template: Keyword `conflicts` doesn't exist Caused by: --> 1:1 | 1 | conflicts | ^-------^ | - = Keyword "conflicts" doesn't exist - Hint: Did you mean "conflict", "conflicting"? - "###); - insta::assert_snapshot!(render_err(r#"commit_id.shorter()"#), @r###" - Error: Failed to parse template: Method "shorter" doesn't exist for type "CommitOrChangeId" + = Keyword `conflicts` doesn't exist + Hint: Did you mean `conflict`, `conflicting`? + "); + insta::assert_snapshot!(render_err(r#"commit_id.shorter()"#), @r" + Error: Failed to parse template: Method `shorter` doesn't exist for type `CommitOrChangeId` Caused by: --> 1:11 | 1 | commit_id.shorter() | ^-----^ | - = Method "shorter" doesn't exist for type "CommitOrChangeId" - Hint: Did you mean "short", "shortest"? - "###); - insta::assert_snapshot!(render_err(r#"oncat()"#), @r###" - Error: Failed to parse template: Function "oncat" doesn't exist + = Method `shorter` doesn't exist for type `CommitOrChangeId` + Hint: Did you mean `short`, `shortest`? + "); + insta::assert_snapshot!(render_err(r#"oncat()"#), @r" + Error: Failed to parse template: Function `oncat` doesn't exist Caused by: --> 1:1 | 1 | oncat() | ^---^ | - = Function "oncat" doesn't exist - Hint: Did you mean "concat", "socat"? - "###); - insta::assert_snapshot!(render_err(r#""".lines().map(|s| se)"#), @r###" - Error: Failed to parse template: Keyword "se" doesn't exist + = Function `oncat` doesn't exist + Hint: Did you mean `concat`, `socat`? + "); + insta::assert_snapshot!(render_err(r#""".lines().map(|s| se)"#), @r#" + Error: Failed to parse template: Keyword `se` doesn't exist Caused by: --> 1:20 | 1 | "".lines().map(|s| se) | ^^ | - = Keyword "se" doesn't exist - Hint: Did you mean "s", "self"? - "###); - insta::assert_snapshot!(render_err(r#"format_id(commit_id)"#), @r#" - Error: Failed to parse template: In alias "format_id(id)" + = Keyword `se` doesn't exist + Hint: Did you mean `s`, `self`? + "#); + insta::assert_snapshot!(render_err(r#"format_id(commit_id)"#), @r" + Error: Failed to parse template: In alias `format_id(id)` Caused by: 1: --> 1:1 | 1 | format_id(commit_id) | ^------------------^ | - = In alias "format_id(id)" + = In alias `format_id(id)` 2: --> 1:4 | 1 | id.sort() | ^--^ | - = Method "sort" doesn't exist for type "CommitOrChangeId" - Hint: Did you mean "short", "shortest"? - "#); + = Method `sort` doesn't exist for type `CommitOrChangeId` + Hint: Did you mean `short`, `shortest`? + "); // -Tbuiltin shows the predefined builtin_* aliases. This isn't 100% // guaranteed, but is nice. - insta::assert_snapshot!(render_err(r#"builtin"#), @r#" - Error: Failed to parse template: Keyword "builtin" doesn't exist + insta::assert_snapshot!(render_err(r#"builtin"#), @r" + Error: Failed to parse template: Keyword `builtin` doesn't exist Caused by: --> 1:1 | 1 | builtin | ^-----^ | - = Keyword "builtin" doesn't exist - Hint: Did you mean "builtin_log_comfortable", "builtin_log_compact", "builtin_log_compact_full_description", "builtin_log_detailed", "builtin_log_node", "builtin_log_node_ascii", "builtin_log_oneline", "builtin_op_log_comfortable", "builtin_op_log_compact", "builtin_op_log_node", "builtin_op_log_node_ascii", "builtin_op_log_oneline"? - "#); + = Keyword `builtin` doesn't exist + Hint: Did you mean `builtin_log_comfortable`, `builtin_log_compact`, `builtin_log_compact_full_description`, `builtin_log_detailed`, `builtin_log_node`, `builtin_log_node_ascii`, `builtin_log_oneline`, `builtin_op_log_comfortable`, `builtin_op_log_compact`, `builtin_op_log_node`, `builtin_op_log_node_ascii`, `builtin_op_log_oneline`? + "); } #[test] @@ -225,162 +225,162 @@ fn test_templater_alias() { insta::assert_snapshot!(render("my_commit_id"), @"000000000000"); insta::assert_snapshot!(render("identity(my_commit_id)"), @"000000000000"); - insta::assert_snapshot!(render_err("commit_id ++ syntax_error"), @r#" - Error: Failed to parse template: In alias "syntax_error" + insta::assert_snapshot!(render_err("commit_id ++ syntax_error"), @r" + Error: Failed to parse template: In alias `syntax_error` Caused by: 1: --> 1:14 | 1 | commit_id ++ syntax_error | ^----------^ | - = In alias "syntax_error" + = In alias `syntax_error` 2: --> 1:5 | 1 | foo. | ^--- | = expected - "#); + "); - insta::assert_snapshot!(render_err("commit_id ++ name_error"), @r#" - Error: Failed to parse template: In alias "name_error" + insta::assert_snapshot!(render_err("commit_id ++ name_error"), @r" + Error: Failed to parse template: In alias `name_error` Caused by: 1: --> 1:14 | 1 | commit_id ++ name_error | ^--------^ | - = In alias "name_error" + = In alias `name_error` 2: --> 1:1 | 1 | unknown_id | ^--------^ | - = Keyword "unknown_id" doesn't exist - "#); + = Keyword `unknown_id` doesn't exist + "); insta::assert_snapshot!(render_err(r#"identity(identity(commit_id.short("")))"#), @r#" - Error: Failed to parse template: In alias "identity(x)" + Error: Failed to parse template: In alias `identity(x)` Caused by: 1: --> 1:1 | 1 | identity(identity(commit_id.short(""))) | ^-------------------------------------^ | - = In alias "identity(x)" + = In alias `identity(x)` 2: --> 1:1 | 1 | x | ^ | - = In function parameter "x" + = In function parameter `x` 3: --> 1:10 | 1 | identity(identity(commit_id.short(""))) | ^---------------------------^ | - = In alias "identity(x)" + = In alias `identity(x)` 4: --> 1:1 | 1 | x | ^ | - = In function parameter "x" + = In function parameter `x` 5: --> 1:35 | 1 | identity(identity(commit_id.short(""))) | ^^ | - = Expected expression of type "Integer", but actual type is "String" + = Expected expression of type `Integer`, but actual type is `String` "#); - insta::assert_snapshot!(render_err("commit_id ++ recurse"), @r#" - Error: Failed to parse template: In alias "recurse" + insta::assert_snapshot!(render_err("commit_id ++ recurse"), @r" + Error: Failed to parse template: In alias `recurse` Caused by: 1: --> 1:14 | 1 | commit_id ++ recurse | ^-----^ | - = In alias "recurse" + = In alias `recurse` 2: --> 1:1 | 1 | recurse1 | ^------^ | - = In alias "recurse1" + = In alias `recurse1` 3: --> 1:1 | 1 | recurse2() | ^--------^ | - = In alias "recurse2()" + = In alias `recurse2()` 4: --> 1:1 | 1 | recurse | ^-----^ | - = Alias "recurse" expanded recursively - "#); + = Alias `recurse` expanded recursively + "); - insta::assert_snapshot!(render_err("identity()"), @r###" - Error: Failed to parse template: Function "identity": Expected 1 arguments + insta::assert_snapshot!(render_err("identity()"), @r" + Error: Failed to parse template: Function `identity`: Expected 1 arguments Caused by: --> 1:10 | 1 | identity() | ^ | - = Function "identity": Expected 1 arguments - "###); - insta::assert_snapshot!(render_err("identity(commit_id, commit_id)"), @r###" - Error: Failed to parse template: Function "identity": Expected 1 arguments + = Function `identity`: Expected 1 arguments + "); + insta::assert_snapshot!(render_err("identity(commit_id, commit_id)"), @r" + Error: Failed to parse template: Function `identity`: Expected 1 arguments Caused by: --> 1:10 | 1 | identity(commit_id, commit_id) | ^------------------^ | - = Function "identity": Expected 1 arguments - "###); + = Function `identity`: Expected 1 arguments + "); insta::assert_snapshot!(render_err(r#"coalesce(label("x", "not boolean"), "")"#), @r#" - Error: Failed to parse template: In alias "coalesce(x, y)" + Error: Failed to parse template: In alias `coalesce(x, y)` Caused by: 1: --> 1:1 | 1 | coalesce(label("x", "not boolean"), "") | ^-------------------------------------^ | - = In alias "coalesce(x, y)" + = In alias `coalesce(x, y)` 2: --> 1:4 | 1 | if(x, x, y) | ^ | - = In function parameter "x" + = In function parameter `x` 3: --> 1:10 | 1 | coalesce(label("x", "not boolean"), "") | ^-----------------------^ | - = Expected expression of type "Boolean", but actual type is "Template" + = Expected expression of type `Boolean`, but actual type is `Template` "#); - insta::assert_snapshot!(render_err("(-my_commit_id)"), @r#" - Error: Failed to parse template: In alias "my_commit_id" + insta::assert_snapshot!(render_err("(-my_commit_id)"), @r" + Error: Failed to parse template: In alias `my_commit_id` Caused by: 1: --> 1:3 | 1 | (-my_commit_id) | ^----------^ | - = In alias "my_commit_id" + = In alias `my_commit_id` 2: --> 1:1 | 1 | commit_id.short() | ^---------------^ | - = Expected expression of type "Integer", but actual type is "String" - "#); + = Expected expression of type `Integer`, but actual type is `String` + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "-r@", "-Tdeprecated()"]); insta::assert_snapshot!(stdout, @r##" @@ -395,7 +395,7 @@ fn test_templater_alias() { 1 | deprecated() | ^----------^ | - = In alias "deprecated()" + = In alias `deprecated()` --> 1:1 | 1 | branches ++ self.contained_in("branches()") @@ -408,7 +408,7 @@ fn test_templater_alias() { 1 | deprecated() | ^----------^ | - = In alias "deprecated()" + = In alias `deprecated()` --> 1:31 | 1 | branches ++ self.contained_in("branches()") @@ -471,14 +471,14 @@ fn test_templater_bad_alias_decl() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "--no-graph", "-r@-", "-Tmy_commit_id"]); insta::assert_snapshot!(stdout, @"000000000000"); - insta::assert_snapshot!(stderr, @r###" - Warning: Failed to load "template-aliases.badfn(a, a)": --> 1:7 + insta::assert_snapshot!(stderr, @r" + Warning: Failed to load `template-aliases.badfn(a, a)`: --> 1:7 | 1 | badfn(a, a) | ^--^ | = Redefinition of function parameter - "###); + "); } #[test] diff --git a/cli/tests/test_workspaces.rs b/cli/tests/test_workspaces.rs index 85ab5858f1..8019098fa0 100644 --- a/cli/tests/test_workspaces.rs +++ b/cli/tests/test_workspaces.rs @@ -949,9 +949,7 @@ fn test_workspaces_forget() { // Revision "@" cannot be used let stderr = test_env.jj_cmd_failure(&main_path, &["log", "-r", "@"]); - insta::assert_snapshot!(stderr, @r###" - Error: Workspace "default" doesn't have a working-copy commit - "###); + insta::assert_snapshot!(stderr, @"Error: Workspace `default` doesn't have a working-copy commit"); // Try to add back the workspace // TODO: We should make this just add it back instead of failing diff --git a/lib/src/fileset.rs b/lib/src/fileset.rs index ce6fd22200..417089198b 100644 --- a/lib/src/fileset.rs +++ b/lib/src/fileset.rs @@ -53,7 +53,7 @@ use crate::repo_path::UiPathParseError; #[derive(Debug, Error)] pub enum FilePatternParseError { /// Unknown pattern kind is specified. - #[error(r#"Invalid file pattern kind "{0}:""#)] + #[error("Invalid file pattern kind `{0}:`")] InvalidKind(String), /// Failed to parse input UI path. #[error(transparent)] diff --git a/lib/src/fileset_parser.rs b/lib/src/fileset_parser.rs index 2091fb96a5..a4bdd51ec3 100644 --- a/lib/src/fileset_parser.rs +++ b/lib/src/fileset_parser.rs @@ -97,12 +97,12 @@ pub struct FilesetParseError { pub enum FilesetParseErrorKind { #[error("Syntax error")] SyntaxError, - #[error(r#"Function "{name}" doesn't exist"#)] + #[error("Function `{name}` doesn't exist")] NoSuchFunction { name: String, candidates: Vec, }, - #[error(r#"Function "{name}": {message}"#)] + #[error("Function `{name}`: {message}")] InvalidArguments { name: String, message: String }, #[error("{0}")] Expression(String), diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 84179f0347..0a6651f3b4 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -69,18 +69,18 @@ use crate::time_util::DatePatternContext; /// Error occurred during symbol resolution. #[derive(Debug, Error)] pub enum RevsetResolutionError { - #[error("Revision \"{name}\" doesn't exist")] + #[error("Revision `{name}` doesn't exist")] NoSuchRevision { name: String, candidates: Vec, }, - #[error("Workspace \"{name}\" doesn't have a working-copy commit")] + #[error("Workspace `{name}` doesn't have a working-copy commit")] WorkspaceMissingWorkingCopy { name: String }, #[error("An empty string is not a valid revision")] EmptyString, - #[error("Commit ID prefix \"{0}\" is ambiguous")] + #[error("Commit ID prefix `{0}` is ambiguous")] AmbiguousCommitIdPrefix(String), - #[error("Change ID prefix \"{0}\" is ambiguous")] + #[error("Change ID prefix `{0}` is ambiguous")] AmbiguousChangeIdPrefix(String), #[error("Unexpected error from store")] StoreError(#[source] BackendError), @@ -1173,7 +1173,7 @@ pub fn lower_expression( ExpressionKind::Modifier(modifier) => { let name = modifier.name; Err(RevsetParseError::expression( - format!(r#"Modifier "{name}:" is not allowed in sub expression"#), + format!("Modifier `{name}:` is not allowed in sub expression"), modifier.name_span, )) } diff --git a/lib/src/revset_parser.rs b/lib/src/revset_parser.rs index 59202f7f0d..612151cc9d 100644 --- a/lib/src/revset_parser.rs +++ b/lib/src/revset_parser.rs @@ -152,46 +152,46 @@ pub struct RevsetParseError { pub enum RevsetParseErrorKind { #[error("Syntax error")] SyntaxError, - #[error("'{op}' is not a prefix operator")] + #[error("`{op}` is not a prefix operator")] NotPrefixOperator { op: String, similar_op: String, description: String, }, - #[error("'{op}' is not a postfix operator")] + #[error("`{op}` is not a postfix operator")] NotPostfixOperator { op: String, similar_op: String, description: String, }, - #[error("'{op}' is not an infix operator")] + #[error("`{op}` is not an infix operator")] NotInfixOperator { op: String, similar_op: String, description: String, }, - #[error(r#"Modifier "{0}" doesn't exist"#)] + #[error("Modifier `{0}` doesn't exist")] NoSuchModifier(String), - #[error(r#"Function "{name}" doesn't exist"#)] + #[error("Function `{name}` doesn't exist")] NoSuchFunction { name: String, candidates: Vec, }, - #[error(r#"Function "{name}": {message}"#)] + #[error("Function `{name}`: {message}")] InvalidFunctionArguments { name: String, message: String }, #[error("Cannot resolve file pattern without workspace")] FsPathWithoutWorkspace, - #[error(r#"Cannot resolve "@" without workspace"#)] + #[error("Cannot resolve `@` without workspace")] WorkingCopyWithoutWorkspace, #[error("Redefinition of function parameter")] RedefinedFunctionParameter, #[error("{0}")] Expression(String), - #[error(r#"In alias "{0}""#)] + #[error("In alias `{0}`")] InAliasExpansion(String), - #[error(r#"In function parameter "{0}""#)] + #[error("In function parameter `{0}`")] InParameterExpansion(String), - #[error(r#"Alias "{0}" expanded recursively"#)] + #[error("Alias `{0}` expanded recursively")] RecursiveAlias(String), } diff --git a/lib/src/str_util.rs b/lib/src/str_util.rs index 22921a85c2..2d23cfe3f2 100644 --- a/lib/src/str_util.rs +++ b/lib/src/str_util.rs @@ -26,7 +26,7 @@ use thiserror::Error; #[derive(Debug, Error)] pub enum StringPatternParseError { /// Unknown pattern kind is specified. - #[error(r#"Invalid string pattern kind "{0}:""#)] + #[error("Invalid string pattern kind `{0}:`")] InvalidKind(String), /// Failed to parse glob pattern. #[error(transparent)] diff --git a/lib/src/time_util.rs b/lib/src/time_util.rs index 590ca72810..a801f93bdb 100644 --- a/lib/src/time_util.rs +++ b/lib/src/time_util.rs @@ -65,7 +65,7 @@ impl From> for DatePatternContext { #[derive(Debug, Error)] pub enum DatePatternParseError { /// Unknown pattern kind is specified. - #[error(r#"Invalid date pattern kind "{0}:""#)] + #[error("Invalid date pattern kind `{0}:`")] InvalidKind(String), /// Failed to parse timestamp. #[error(transparent)]