From d528719ab8cdcb1a689ebe75a55e9304c74705ac Mon Sep 17 00:00:00 2001 From: Jakob Hellermann Date: Sun, 2 Feb 2025 13:44:37 +0100 Subject: [PATCH] tests: run `insta --force-update-snapshots` --- cli/src/formatter.rs | 30 +- cli/src/git_util.rs | 2 +- cli/src/merge_tools/builtin.rs | 20 +- cli/src/merge_tools/mod.rs | 12 +- cli/src/template_builder.rs | 80 +- cli/src/text_util.rs | 20 +- cli/tests/test_abandon_command.rs | 68 +- cli/tests/test_absorb_command.rs | 4 +- cli/tests/test_acls.rs | 32 +- cli/tests/test_advance_bookmarks.rs | 100 +-- cli/tests/test_alias.rs | 78 +- cli/tests/test_backout_command.rs | 32 +- cli/tests/test_bookmark_command.rs | 586 ++++++------- cli/tests/test_builtin_aliases.rs | 38 +- cli/tests/test_commit_command.rs | 74 +- cli/tests/test_commit_template.rs | 227 +++-- cli/tests/test_completion.rs | 18 +- cli/tests/test_concurrent_operations.rs | 53 +- cli/tests/test_config_command.rs | 200 ++--- cli/tests/test_copy_detection.rs | 4 +- cli/tests/test_debug_command.rs | 52 +- cli/tests/test_describe_command.rs | 164 ++-- cli/tests/test_diff_command.rs | 418 +++++----- cli/tests/test_diffedit_command.rs | 192 ++--- cli/tests/test_duplicate_command.rs | 180 ++-- cli/tests/test_edit_command.rs | 24 +- cli/tests/test_evolog_command.rs | 48 +- cli/tests/test_file_chmod_command.rs | 68 +- cli/tests/test_file_show_command.rs | 44 +- cli/tests/test_file_track_untrack_commands.rs | 56 +- cli/tests/test_fix_command.rs | 185 ++--- cli/tests/test_git_clone.rs | 100 +-- cli/tests/test_git_colocated.rs | 316 ++++--- cli/tests/test_git_fetch.rs | 370 ++++----- cli/tests/test_git_import_export.rs | 88 +- cli/tests/test_git_init.rs | 172 ++-- cli/tests/test_git_private_commits.rs | 32 +- cli/tests/test_git_push.rs | 320 ++++--- cli/tests/test_git_remotes.rs | 70 +- cli/tests/test_git_submodule.rs | 16 +- cli/tests/test_gitignores.rs | 20 +- cli/tests/test_global_opts.rs | 164 ++-- cli/tests/test_help_command.rs | 36 +- cli/tests/test_immutable_commits.rs | 134 ++- cli/tests/test_init_command.rs | 16 +- cli/tests/test_interdiff_command.rs | 28 +- cli/tests/test_log_command.rs | 329 ++++---- cli/tests/test_new_command.rs | 156 ++-- cli/tests/test_next_prev_commands.rs | 396 +++++---- cli/tests/test_operations.rs | 532 +++++------- cli/tests/test_parallelize_command.rs | 128 ++- cli/tests/test_rebase_command.rs | 780 +++++++++--------- cli/tests/test_repo_change_report.rs | 44 +- cli/tests/test_resolve_command.rs | 366 ++++---- cli/tests/test_restore_command.rs | 96 +-- cli/tests/test_revset_output.rs | 88 +- cli/tests/test_root.rs | 4 +- cli/tests/test_shell_completion.rs | 4 +- cli/tests/test_show_command.rs | 52 +- cli/tests/test_simplify_parents_command.rs | 84 +- cli/tests/test_sparse_command.rs | 68 +- cli/tests/test_split_command.rs | 168 ++-- cli/tests/test_squash_command.rs | 440 ++++------ cli/tests/test_status_command.rs | 52 +- cli/tests/test_tag_command.rs | 20 +- cli/tests/test_templater.rs | 16 +- cli/tests/test_undo.rs | 100 +-- cli/tests/test_unsquash_command.rs | 140 ++-- cli/tests/test_util_command.rs | 16 +- cli/tests/test_working_copy.rs | 32 +- cli/tests/test_workspaces.rs | 334 ++++---- lib/src/config_resolver.rs | 32 +- lib/src/fileset.rs | 48 +- lib/src/fileset_parser.rs | 4 +- lib/src/git_backend.rs | 12 +- lib/src/graph.rs | 216 ++--- lib/src/revset.rs | 420 +++++----- lib/tests/test_annotate.rs | 32 +- lib/tests/test_conflicts.rs | 144 ++-- lib/tests/test_git.rs | 8 +- lib/tests/test_gpg.rs | 16 +- lib/tests/test_id_prefix.rs | 24 +- lib/tests/test_local_working_copy.rs | 24 +- lib/tests/test_revset.rs | 16 +- 84 files changed, 4702 insertions(+), 5730 deletions(-) diff --git a/cli/src/formatter.rs b/cli/src/formatter.rs index 974e886e76..cde89873b2 100644 --- a/cli/src/formatter.rs +++ b/cli/src/formatter.rs @@ -857,7 +857,7 @@ mod tests { formatter.pop_label().unwrap(); write!(formatter, " after ").unwrap(); drop(formatter); - insta::assert_snapshot!(String::from_utf8(output).unwrap(), @" before  inside  after "); + insta::assert_snapshot!(String::from_utf8(output).unwrap(), @" before  inside  after"); } #[test] @@ -907,7 +907,7 @@ mod tests { formatter.pop_label().unwrap(); writeln!(formatter).unwrap(); drop(formatter); - insta::assert_snapshot!(String::from_utf8(output).unwrap(), @r###" + insta::assert_snapshot!(String::from_utf8(output).unwrap(), @r"  fg only   bg only   bold only  @@ -915,7 +915,7 @@ mod tests {  underlined only   single rule   two rules  - "###); + "); } #[test] @@ -1005,7 +1005,7 @@ mod tests { write!(formatter, " after outer ").unwrap(); drop(formatter); insta::assert_snapshot!(String::from_utf8(output).unwrap(), - @" before outer  before inner  inside inner  after inner  after outer "); + @" before outer  before inner  inside inner  after inner  after outer"); } #[test] @@ -1027,7 +1027,7 @@ mod tests { formatter.pop_label().unwrap(); drop(formatter); insta::assert_snapshot!(String::from_utf8(output).unwrap(), - @" not colored  colored  not colored "); + @" not colored  colored  not colored"); } #[test] @@ -1106,10 +1106,10 @@ mod tests { write!(formatter, " and back.").unwrap(); drop(formatter); insta::assert_snapshot!(String::from_utf8(output).unwrap(), - @r###" + @r" Blue on yellow,  default fg,  and back. Blue on yellow,  default bg,  and back. - "###); + "); } #[test] @@ -1149,7 +1149,7 @@ mod tests { formatter.pop_label().unwrap(); formatter.pop_label().unwrap(); drop(formatter); - insta::assert_snapshot!(String::from_utf8(output).unwrap(), @" hello "); + insta::assert_snapshot!(String::from_utf8(output).unwrap(), @" hello"); } #[test] @@ -1241,9 +1241,7 @@ mod tests { write!(writer, "Message").unwrap(); writeln!(writer, " continues").unwrap(); drop(formatter); - insta::assert_snapshot!(String::from_utf8(output).unwrap(), @r###" - Heading: Message continues - "###); + insta::assert_snapshot!(String::from_utf8(output).unwrap(), @"Heading: Message continues"); } #[test] @@ -1259,7 +1257,7 @@ mod tests { write!(writer, "").unwrap(); write!(writer, "").unwrap(); drop(formatter); - insta::assert_snapshot!(String::from_utf8(output).unwrap(), @"Heading: "); + insta::assert_snapshot!(String::from_utf8(output).unwrap(), @"Heading:"); } #[test] @@ -1274,7 +1272,7 @@ mod tests { insta::assert_snapshot!( str::from_utf8(recorder.data()).unwrap(), - @" outer1 inner1 inner2 outer2 "); + @" outer1 inner1 inner2 outer2"); // Replayed output should be labeled. let config = config_from_string(r#" colors.inner = "red" "#); @@ -1284,7 +1282,7 @@ mod tests { drop(formatter); insta::assert_snapshot!( String::from_utf8(output).unwrap(), - @" outer1  inner1 inner2  outer2 "); + @" outer1  inner1 inner2  outer2"); // Replayed output should be split at push/pop_label() call. let mut output: Vec = vec![]; @@ -1319,7 +1317,7 @@ mod tests { recorder.replay(&mut formatter).unwrap(); drop(formatter); insta::assert_snapshot!( - String::from_utf8(output).unwrap(), @" outer1  inner1 inner2  outer2 "); + String::from_utf8(output).unwrap(), @" outer1  inner1 inner2  outer2"); let mut output: Vec = vec![]; let mut formatter = ColorFormatter::for_config(&mut output, &config, false).unwrap(); @@ -1333,6 +1331,6 @@ mod tests { .unwrap(); drop(formatter); insta::assert_snapshot!( - String::from_utf8(output).unwrap(), @" outer1  inner1 inner2  outer2 "); + String::from_utf8(output).unwrap(), @" outer1  inner1 inner2  outer2"); } } diff --git a/cli/src/git_util.rs b/cli/src/git_util.rs index 614f9ba659..3a80584c64 100644 --- a/cli/src/git_util.rs +++ b/cli/src/git_util.rs @@ -702,7 +702,7 @@ mod tests { }; // First output is after the initial delay assert_snapshot!(update(crate::progress::INITIAL_DELAY - Duration::from_millis(1), 0.1), @""); - assert_snapshot!(update(Duration::from_millis(1), 0.10), @"[?25l\r 10% [█▊ ]"); + assert_snapshot!(update(Duration::from_millis(1), 0.10), @"\u{1b}[?25l\r 10% [█▊ ]\u{1b}[K"); // No updates for the next 30 milliseconds assert_snapshot!(update(Duration::from_millis(10), 0.11), @""); assert_snapshot!(update(Duration::from_millis(10), 0.12), @""); diff --git a/cli/src/merge_tools/builtin.rs b/cli/src/merge_tools/builtin.rs index b545965d6a..9f5b84832c 100644 --- a/cli/src/merge_tools/builtin.rs +++ b/cli/src/merge_tools/builtin.rs @@ -733,7 +733,7 @@ mod tests { ConflictMarkerStyle::Diff, ) .unwrap(); - insta::assert_debug_snapshot!(files, @r###" + insta::assert_debug_snapshot!(files, @r#" [ File { old_path: None, @@ -821,7 +821,7 @@ mod tests { ], }, ] - "###); + "#); let no_changes_tree_id = apply_diff_builtin( store, @@ -870,7 +870,7 @@ mod tests { ConflictMarkerStyle::Diff, ) .unwrap(); - insta::assert_debug_snapshot!(files, @r###" + insta::assert_debug_snapshot!(files, @r#" [ File { old_path: None, @@ -893,7 +893,7 @@ mod tests { ], }, ] - "###); + "#); let no_changes_tree_id = apply_diff_builtin( store, &left_tree, @@ -941,7 +941,7 @@ mod tests { ConflictMarkerStyle::Diff, ) .unwrap(); - insta::assert_debug_snapshot!(files, @r###" + insta::assert_debug_snapshot!(files, @r#" [ File { old_path: None, @@ -964,7 +964,7 @@ mod tests { ], }, ] - "###); + "#); let no_changes_tree_id = apply_diff_builtin( store, &left_tree, @@ -1013,7 +1013,7 @@ mod tests { ConflictMarkerStyle::Diff, ) .unwrap(); - insta::assert_debug_snapshot!(files, @r###" + insta::assert_debug_snapshot!(files, @r#" [ File { old_path: None, @@ -1036,7 +1036,7 @@ mod tests { ], }, ] - "###); + "#); let no_changes_tree_id = apply_diff_builtin( store, &left_tree, @@ -1103,7 +1103,7 @@ mod tests { .unwrap(); let merge_result = files::merge(&content); let sections = make_merge_sections(merge_result).unwrap(); - insta::assert_debug_snapshot!(sections, @r###" + insta::assert_debug_snapshot!(sections, @r#" [ Changed { lines: [ @@ -1151,6 +1151,6 @@ mod tests { ], }, ] - "###); + "#); } } diff --git a/cli/src/merge_tools/mod.rs b/cli/src/merge_tools/mod.rs index d017bf90bb..49e4012341 100644 --- a/cli/src/merge_tools/mod.rs +++ b/cli/src/merge_tools/mod.rs @@ -703,11 +703,11 @@ mod tests { insta::assert_debug_snapshot!(get(":builtin", "").unwrap(), @"Builtin"); // Just program name - insta::assert_debug_snapshot!(get("my diff", "").unwrap_err(), @r###" + insta::assert_debug_snapshot!(get("my diff", "").unwrap_err(), @r#" MergeArgsNotConfigured { tool_name: "my diff", } - "###); + "#); // Pick from merge-tools insta::assert_debug_snapshot!(get( @@ -763,11 +763,11 @@ mod tests { insta::assert_debug_snapshot!(get("").unwrap(), @"Builtin"); // Just program name - insta::assert_debug_snapshot!(get(r#"ui.merge-editor = "my-merge""#).unwrap_err(), @r###" + insta::assert_debug_snapshot!(get(r#"ui.merge-editor = "my-merge""#).unwrap_err(), @r#" MergeArgsNotConfigured { tool_name: "my-merge", } - "###); + "#); // String args insta::assert_debug_snapshot!( @@ -871,11 +871,11 @@ mod tests { // List args should never be a merge-tools key insta::assert_debug_snapshot!( - get(r#"ui.merge-editor = ["meld"]"#).unwrap_err(), @r###" + get(r#"ui.merge-editor = ["meld"]"#).unwrap_err(), @r#" MergeArgsNotConfigured { tool_name: "meld", } - "###); + "#); // Invalid type assert!(get(r#"ui.merge-editor.k = 0"#).is_err()); diff --git a/cli/src/template_builder.rs b/cli/src/template_builder.rs index cf8c9dd7a7..4dba84f31d 100644 --- a/cli/src/template_builder.rs +++ b/cli/src/template_builder.rs @@ -2069,14 +2069,14 @@ mod tests { env.add_keyword("description", || L::wrap_string(Literal("".to_owned()))); env.add_keyword("empty", || L::wrap_boolean(Literal(true))); - insta::assert_snapshot!(env.parse_err(r#"description ()"#), @r#" + insta::assert_snapshot!(env.parse_err(r#"description ()"#), @r" --> 1:13 | 1 | description () | ^--- | = expected , `++`, `||`, `&&`, `==`, `!=`, `>=`, `>`, `<=`, or `<` - "#); + "); insta::assert_snapshot!(env.parse_err(r#"foo"#), @r" --> 1:1 @@ -2095,14 +2095,14 @@ mod tests { | = Function `foo` doesn't exist "); - insta::assert_snapshot!(env.parse_err(r#"false()"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"false()"#), @r" --> 1:1 | 1 | false() | ^---^ | = Expected identifier - "###); + "); insta::assert_snapshot!(env.parse_err(r#"!foo"#), @r" --> 1:2 @@ -2298,14 +2298,14 @@ mod tests { = Expected expression of type `Boolean`, but actual type is `Template` "#); - insta::assert_snapshot!(env.parse_err(r#"|x| description"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"|x| description"#), @r" --> 1:1 | 1 | |x| description | ^-------------^ | = Lambda cannot be defined here - "###); + "); } #[test] @@ -2515,31 +2515,31 @@ mod tests { insta::assert_snapshot!(env.render_ok(r#""a\nb\nc".lines().map(identity)"#), @"a b c"); // Not a lambda expression - insta::assert_snapshot!(env.parse_err(r#""a".lines().map(empty)"#), @r###" + insta::assert_snapshot!(env.parse_err(r#""a".lines().map(empty)"#), @r#" --> 1:17 | 1 | "a".lines().map(empty) | ^---^ | = Expected lambda expression - "###); + "#); // Bad lambda parameter count - insta::assert_snapshot!(env.parse_err(r#""a".lines().map(|| "")"#), @r###" + insta::assert_snapshot!(env.parse_err(r#""a".lines().map(|| "")"#), @r#" --> 1:18 | 1 | "a".lines().map(|| "") | ^ | = Expected 1 lambda parameters - "###); - insta::assert_snapshot!(env.parse_err(r#""a".lines().map(|a, b| "")"#), @r###" + "#); + insta::assert_snapshot!(env.parse_err(r#""a".lines().map(|a, b| "")"#), @r#" --> 1:18 | 1 | "a".lines().map(|a, b| "") | ^--^ | = Expected 1 lambda parameters - "###); + "#); // Bad lambda output insta::assert_snapshot!(env.parse_err(r#""a".lines().filter(|s| s ++ "\n")"#), @r#" --> 1:24 @@ -2817,34 +2817,34 @@ mod tests { @"19700101 00:00:00"); // Invalid format string - insta::assert_snapshot!(env.parse_err(r#"t0.format("%_")"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"t0.format("%_")"#), @r#" --> 1:11 | 1 | t0.format("%_") | ^--^ | = Invalid time format - "###); + "#); // Invalid type - insta::assert_snapshot!(env.parse_err(r#"t0.format(0)"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"t0.format(0)"#), @r" --> 1:11 | 1 | t0.format(0) | ^ | = Expected string literal - "###); + "); // Dynamic string isn't supported yet - insta::assert_snapshot!(env.parse_err(r#"t0.format("%Y" ++ "%m")"#), @r###" + insta::assert_snapshot!(env.parse_err(r#"t0.format("%Y" ++ "%m")"#), @r#" --> 1:11 | 1 | t0.format("%Y" ++ "%m") | ^----------^ | = Expected string literal - "###); + "#); // Literal alias expansion env.add_alias("time_format", r#""%Y-%m-%d""#); @@ -2874,17 +2874,17 @@ mod tests { insta::assert_snapshot!( env.render_ok(r#"fill(20, "The quick fox jumps over the " ++ label("error", "lazy") ++ " dog\n")"#), - @r###" + @r" The quick fox jumps over the lazy dog - "###); + "); // A low value will not chop words, but can chop a label by words insta::assert_snapshot!( env.render_ok(r#"fill(9, "Longlonglongword an some short words " ++ label("error", "longlonglongword and short words") ++ " back out\n")"#), - @r###" + @r" Longlonglongword an some short @@ -2893,13 +2893,13 @@ mod tests { and short words back out - "###); + "); // Filling to 0 means breaking at every word insta::assert_snapshot!( env.render_ok(r#"fill(0, "The quick fox jumps over the " ++ label("error", "lazy") ++ " dog\n")"#), - @r###" + @r" The quick fox @@ -2908,13 +2908,13 @@ mod tests { the lazy dog - "###); + "); // Filling to -0 is the same as 0 insta::assert_snapshot!( env.render_ok(r#"fill(-0, "The quick fox jumps over the " ++ label("error", "lazy") ++ " dog\n")"#), - @r###" + @r" The quick fox @@ -2923,7 +2923,7 @@ mod tests { the lazy dog - "###); + "); // Filling to negative width is an error insta::assert_snapshot!( @@ -2936,23 +2936,23 @@ mod tests { env.render_ok(r#""START marker to help insta\n" ++ indent(" ", fill(20, "The quick fox jumps over the " ++ label("error", "lazy") ++ " dog\n"))"#), - @r###" + @r" START marker to help insta The quick fox jumps over the lazy dog - "###); + "); // Word-wrap indented (no special handling for leading spaces) insta::assert_snapshot!( env.render_ok(r#""START marker to help insta\n" ++ fill(20, indent(" ", "The quick fox jumps over the " ++ label("error", "lazy") ++ " dog\n"))"#), - @r###" + @r" START marker to help insta The quick fox jumps over the lazy dog - "###); + "); } #[test] @@ -2971,36 +2971,36 @@ mod tests { // "\n" at end of labeled text insta::assert_snapshot!( env.render_ok(r#"indent("__", label("error", "a\n") ++ label("warning", "b\n"))"#), - @r###" + @r" __a __b - "###); + "); // "\n" in labeled text insta::assert_snapshot!( env.render_ok(r#"indent("__", label("error", "a") ++ label("warning", "b\nc"))"#), - @r###" + @r" __ab __c - "###); + "); // Labeled prefix + unlabeled content insta::assert_snapshot!( env.render_ok(r#"indent(label("error", "XX"), "a\nb\n")"#), - @r###" + @r" XXa XXb - "###); + "); // Nested indent, silly but works insta::assert_snapshot!( env.render_ok(r#"indent(label("hint", "A"), label("warning", indent(label("hint", "B"), label("error", "x\n") ++ "y")))"#), - @r###" + @r" ABx ABy - "###); + "); } #[test] @@ -3107,7 +3107,7 @@ mod tests { ++ "\e\\" ++ "Example" ++ "\x1b]8;;\x1B\\""#), - @r#"␛]8;;http://example.com␛\Example␛]8;;␛\"#); + @r"␛]8;;http://example.com␛\Example␛]8;;␛\"); // Don't sanitize ANSI escape with raw_escape_sequence insta::assert_snapshot!(env.render_ok(r#"raw_escape_sequence("\e")"#), @""); @@ -3119,7 +3119,7 @@ mod tests { ++ "\e\\" ++ "Example" ++ "\x1b]8;;\x1B\\")"#), - @r#"]8;;http://example.com\Example]8;;\"#); + @r"]8;;http://example.com\Example]8;;\"); } #[test] diff --git a/cli/src/text_util.rs b/cli/src/text_util.rs index 3c73158165..dc04818bcd 100644 --- a/cli/src/text_util.rs +++ b/cli/src/text_util.rs @@ -1410,12 +1410,12 @@ mod tests { recorder.pop_label().unwrap(); insta::assert_snapshot!( format_colored(|formatter| write_wrapped(formatter, &recorder, 7)), - @r###" + @r" foo bar baz qux quux - "### + " ); // Multiple label chunks in a line @@ -1427,12 +1427,12 @@ mod tests { } insta::assert_snapshot!( format_colored(|formatter| write_wrapped(formatter, &recorder, 7)), - @r###" + @r" foo bar baz qux quux - "### + " ); // Empty lines should not cause panic @@ -1444,13 +1444,13 @@ mod tests { } insta::assert_snapshot!( format_colored(|formatter| write_wrapped(formatter, &recorder, 10)), - @r###" + @r"  foo  bar baz  - "### + " ); // Split at label boundary @@ -1464,10 +1464,10 @@ mod tests { recorder.pop_label().unwrap(); insta::assert_snapshot!( format_colored(|formatter| write_wrapped(formatter, &recorder, 10)), - @r###" + @r" foo bar baz - "### + " ); // Do not split at label boundary "ba|z" (since it's a single word) @@ -1480,10 +1480,10 @@ mod tests { recorder.pop_label().unwrap(); insta::assert_snapshot!( format_colored(|formatter| write_wrapped(formatter, &recorder, 10)), - @r###" + @r" foo bar baz - "### + " ); } diff --git a/cli/tests/test_abandon_command.rs b/cli/tests/test_abandon_command.rs index 66856d4896..56078eb9cc 100644 --- a/cli/tests/test_abandon_command.rs +++ b/cli/tests/test_abandon_command.rs @@ -40,7 +40,7 @@ fn test_basics() { create_commit(&test_env, &repo_path, "d", &["c"]); create_commit(&test_env, &repo_path, "e", &["a", "d"]); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ [znk] e ├─╮ │ ○ [vru] d @@ -50,19 +50,19 @@ fn test_basics() { ○ │ [rlv] a ├─╯ ◆ [zzz] - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "--retain-bookmarks", "d"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Abandoned commit vruxwmqv b7c62f28 d | d Rebased 1 descendant commits onto parents of abandoned commits Working copy now at: znkkpsqq 11a2e10e e | e Parent commit : rlvkpnrz 2443ea76 a | a Parent commit : royxmykx fe2e8e8b c d | c Added 0 files, modified 0 files, removed 1 files - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ [znk] e ├─╮ │ ○ [roy] c d @@ -71,7 +71,7 @@ fn test_basics() { ○ │ [rlv] a ├─╯ ◆ [zzz] - "###); + "); test_env.jj_cmd_ok(&repo_path, &["undo"]); let (stdout, stderr) = test_env.jj_cmd_ok( @@ -79,14 +79,14 @@ fn test_basics() { &["abandon", "--retain-bookmarks"], /* abandons `e` */ ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Abandoned commit znkkpsqq 5557ece3 e | e Working copy now at: nkmrtpmo d4f8ea73 (empty) (no description set) Parent commit : rlvkpnrz 2443ea76 a e?? | a Parent commit : vruxwmqv b7c62f28 d e?? | d Added 0 files, modified 0 files, removed 1 files - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ [nkm] ├─╮ │ ○ [vru] d e?? @@ -96,7 +96,7 @@ fn test_basics() { ○ │ [rlv] a e?? ├─╯ ◆ [zzz] - "###); + "); test_env.jj_cmd_ok(&repo_path, &["undo"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "descendants(d)"]); @@ -166,9 +166,7 @@ fn test_basics() { "); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "none()"]); - insta::assert_snapshot!(stderr, @r###" - No revisions to abandon. - "###); + insta::assert_snapshot!(stderr, @"No revisions to abandon."); } // This behavior illustrates https://github.com/jj-vcs/jj/issues/2600. @@ -189,7 +187,7 @@ fn test_bug_2600() { create_commit(&test_env, &repo_path, "c", &["b"]); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ [znk] c ○ [vru] b ├─╮ @@ -198,7 +196,7 @@ fn test_bug_2600() { ○ [zsu] base ○ [rlv] nottherootcommit ◆ [zzz] - "###); + "); let setup_opid = test_env.current_operation_id(&repo_path); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); @@ -271,7 +269,7 @@ fn test_bug_2600() { test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // ========= Reminder of the setup =========== - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ [znk] c ○ [vru] b ├─╮ @@ -280,11 +278,11 @@ fn test_bug_2600() { ○ [zsu] base ○ [rlv] nottherootcommit ◆ [zzz] - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "--retain-bookmarks", "a", "b"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Abandoned the following commits: vruxwmqv 8c0dced0 b | b royxmykx 98f3b9ba a | a @@ -292,19 +290,17 @@ fn test_bug_2600() { Working copy now at: znkkpsqq 84fac1f8 c | c Parent commit : zsuskuln 73c929fc a b base | base Added 0 files, modified 0 files, removed 2 files - "###); + "); // Commit "c" should have "base" as parent. As when we abandoned "a", it should // not have two parent pointers to the same commit. - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ [znk] c ○ [zsu] a b base ○ [rlv] nottherootcommit ◆ [zzz] - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "list", "b"]); - insta::assert_snapshot!(stdout, @r###" - b: zsuskuln 73c929fc base - "###); + insta::assert_snapshot!(stdout, @"b: zsuskuln 73c929fc base"); insta::assert_snapshot!(stderr, @""); } @@ -321,7 +317,7 @@ fn test_bug_2600_rootcommit_special_case() { create_commit(&test_env, &repo_path, "c", &["b"]); // Setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ [vru] c ○ [roy] b ├─╮ @@ -329,13 +325,11 @@ fn test_bug_2600_rootcommit_special_case() { ├─╯ ○ [rlv] base ◆ [zzz] - "###); + "); // Now, the test let stderr = test_env.jj_cmd_failure(&repo_path, &["abandon", "base"]); - insta::assert_snapshot!(stderr, @r###" - Error: The Git backend does not support creating merge commits with the root commit as one of the parents. - "###); + insta::assert_snapshot!(stderr, @"Error: The Git backend does not support creating merge commits with the root commit as one of the parents."); } #[test] @@ -348,10 +342,10 @@ fn test_double_abandon() { // Test the setup insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r", "a"]) - , @r###" + , @r" rlvkpnrz test.user@example.com 2001-02-03 08:05:09 a 2443ea76 a - "###); + "); let commit_id = test_env.jj_cmd_success( &repo_path, @@ -369,10 +363,10 @@ fn test_double_abandon() { "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", &commit_id]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Abandoned commit rlvkpnrz hidden 2443ea76 a Nothing changed. - "###); + "); } #[test] @@ -391,14 +385,14 @@ fn test_abandon_restore_descendants() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["abandon", "-r@-", "--restore-descendants"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Abandoned commit rlvkpnrz 225adef1 (no description set) Rebased 1 descendant commits (while preserving their content) onto parents of abandoned commits Working copy now at: kkmpptxz a734deb0 (no description set) Parent commit : qpvuntsm 485d52a9 (no description set) - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" diff --git a/file b/file index 257cc5642c..76018072e0 100644 --- a/file @@ -406,7 +400,7 @@ fn test_abandon_restore_descendants() { @@ -1,1 +1,1 @@ -foo +baz - "#); + "); } fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String { diff --git a/cli/tests/test_absorb_command.rs b/cli/tests/test_absorb_command.rs index 23443fe0c5..3e5493c5bd 100644 --- a/cli/tests/test_absorb_command.rs +++ b/cli/tests/test_absorb_command.rs @@ -392,7 +392,7 @@ fn test_absorb_conflict() { test_env.jj_cmd_ok(&repo_path, &["new", "root()"]); std::fs::write(repo_path.join("file1"), "2a\n2b\n").unwrap(); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-r@", "-ddescription(1)"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Rebased 1 commits onto destination Working copy now at: kkmpptxz 74405a07 (conflict) (no description set) Parent commit : qpvuntsm 3619e4e5 1 @@ -406,7 +406,7 @@ fn test_absorb_conflict() { Then use `jj resolve`, or edit the conflict markers in the file directly. Once the conflicts are resolved, you may want to inspect the result with `jj diff`. Then run `jj squash` to move the resolution into the conflicted commit. - "###); + "); let conflict_content = String::from_utf8(std::fs::read(repo_path.join("file1")).unwrap()).unwrap(); diff --git a/cli/tests/test_acls.rs b/cli/tests/test_acls.rs index 87a5b71d8d..e361454493 100644 --- a/cli/tests/test_acls.rs +++ b/cli/tests/test_acls.rs @@ -41,7 +41,7 @@ fn test_diff() { SecretBackend::adopt_git_repo(&repo_path); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--color-words"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" Modified regular file a-first: 1 1: foobar Access denied to added-secret: No access @@ -50,27 +50,27 @@ fn test_diff() { Access denied to modified-secret: No access Modified regular file z-last: 1 1: foobar - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--summary"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" M a-first C {a-first => added-secret} D deleted-secret M dir/secret M modified-secret M z-last - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--types"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" FF a-first FF {a-first => added-secret} F- deleted-secret FF dir/secret FF modified-secret FF z-last - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" a-first | 2 +- {a-first => added-secret} | 2 +- deleted-secret | 1 - @@ -78,12 +78,12 @@ fn test_diff() { modified-secret | 0 z-last | 2 +- 6 files changed, 3 insertions(+), 4 deletions(-) - "###); + "); let assert = test_env .jj_cmd(&repo_path, &["diff", "--git"]) .assert() .failure(); - insta::assert_snapshot!(get_stdout_string(&assert).replace('\\', "/"), @r###" + insta::assert_snapshot!(get_stdout_string(&assert).replace('\\', "/"), @r" diff --git a/a-first b/a-first index 257cc5642c..5716ca5987 100644 --- a/a-first @@ -91,11 +91,11 @@ fn test_diff() { @@ -1,1 +1,1 @@ -foo +bar - "###); - insta::assert_snapshot!(get_stderr_string(&assert), @r#" + "); + insta::assert_snapshot!(get_stderr_string(&assert), @r" Error: Access denied to added-secret Caused by: No access - "#); + "); // TODO: Test external tool } @@ -122,11 +122,9 @@ fn test_file_list_show() { insta::assert_snapshot!(stderr, @""); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "show", "."]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" foo baz - "###); - insta::assert_snapshot!(stderr.replace('\\', "/"), @r###" - Warning: Path 'secret' exists but access is denied: No access - "###); + "); + insta::assert_snapshot!(stderr.replace('\\', "/"), @"Warning: Path 'secret' exists but access is denied: No access"); } diff --git a/cli/tests/test_advance_bookmarks.rs b/cli/tests/test_advance_bookmarks.rs index 2003b7bfbd..53ea779c19 100644 --- a/cli/tests/test_advance_bookmarks.rs +++ b/cli/tests/test_advance_bookmarks.rs @@ -75,32 +75,32 @@ fn test_advance_bookmarks_enabled(make_commit: CommitFn) { // Check the initial state of the repo. insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ◆ bookmarks{test_bookmark} desc: - "###); + "); } // Run jj commit, which will advance the bookmark pointing to @-. make_commit(&test_env, &workspace_path, "first"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); } // Now disable advance bookmarks and commit again. The bookmark shouldn't move. set_advance_bookmarks(&test_env, false); make_commit(&test_env, &workspace_path, "second"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{} desc: second ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); } } @@ -117,19 +117,19 @@ fn test_advance_bookmarks_at_minus(make_commit: CommitFn) { test_env.jj_cmd_ok(&workspace_path, &["bookmark", "create", "test_bookmark"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{test_bookmark} desc: ◆ bookmarks{} desc: - "###); + "); } make_commit(&test_env, &workspace_path, "first"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); } // Create a second bookmark pointing to @. On the next commit, only the first @@ -137,12 +137,12 @@ fn test_advance_bookmarks_at_minus(make_commit: CommitFn) { test_env.jj_cmd_ok(&workspace_path, &["bookmark", "create", "test_bookmark2"]); make_commit(&test_env, &workspace_path, "second"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{test_bookmark test_bookmark2} desc: second ○ bookmarks{} desc: first ◆ bookmarks{} desc: - "###); + "); } } @@ -163,20 +163,20 @@ fn test_advance_bookmarks_overrides(make_commit: CommitFn) { // Check the initial state of the repo. insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ◆ bookmarks{test_bookmark} desc: - "###); + "); } // Commit will not advance the bookmark since advance-bookmarks is disabled. make_commit(&test_env, &workspace_path, "first"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{} desc: first ◆ bookmarks{test_bookmark} desc: - "###); + "); } // Now enable advance bookmarks for "test_bookmark", move the bookmark, and @@ -191,20 +191,20 @@ fn test_advance_bookmarks_overrides(make_commit: CommitFn) { &["bookmark", "set", "test_bookmark", "-r", "@-"], ); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); } make_commit(&test_env, &workspace_path, "second"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{} desc: second ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); } // Now disable advance bookmarks for "test_bookmark" and "second_bookmark", @@ -217,13 +217,13 @@ fn test_advance_bookmarks_overrides(make_commit: CommitFn) { ); make_commit(&test_env, &workspace_path, "third"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{} desc: third ○ bookmarks{} desc: second ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); } // If we create a new bookmark at @- and move test_bookmark there as well. When @@ -238,24 +238,24 @@ fn test_advance_bookmarks_overrides(make_commit: CommitFn) { &["bookmark", "set", "test_bookmark", "-r", "@-"], ); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{second_bookmark test_bookmark} desc: third ○ bookmarks{} desc: second ○ bookmarks{} desc: first ◆ bookmarks{} desc: - "###); + "); } make_commit(&test_env, &workspace_path, "fourth"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{} desc: fourth ○ bookmarks{second_bookmark test_bookmark} desc: third ○ bookmarks{} desc: second ○ bookmarks{} desc: first ◆ bookmarks{} desc: - "###); + "); } } @@ -279,20 +279,20 @@ fn test_advance_bookmarks_multiple_bookmarks(make_commit: CommitFn) { insta::allow_duplicates! { // Check the initial state of the repo. - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ◆ bookmarks{first_bookmark second_bookmark} desc: - "###); + "); } // Both bookmarks are eligible and both will advance. make_commit(&test_env, &workspace_path, "first"); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{first_bookmark second_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); } } @@ -307,10 +307,10 @@ fn test_new_advance_bookmarks_interior() { set_advance_bookmarks(&test_env, true); // Check the initial state of the repo. - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ◆ bookmarks{} desc: - "###); + "); // Create a gap in the commits for us to insert our new commit with --before. test_env.jj_cmd_ok(&workspace_path, &["commit", "-m", "first"]); @@ -320,23 +320,23 @@ fn test_new_advance_bookmarks_interior() { &workspace_path, &["bookmark", "create", "-r", "@---", "test_bookmark"], ); - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{} desc: third ○ bookmarks{} desc: second ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); test_env.jj_cmd_ok(&workspace_path, &["new", "-r", "@--"]); - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: │ ○ bookmarks{} desc: third ├─╯ ○ bookmarks{test_bookmark} desc: second ○ bookmarks{} desc: first ◆ bookmarks{} desc: - "###); + "); } // If the `--before` flag is passed to `jj new`, bookmarks are not advanced. @@ -349,10 +349,10 @@ fn test_new_advance_bookmarks_before() { set_advance_bookmarks(&test_env, true); // Check the initial state of the repo. - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ◆ bookmarks{} desc: - "###); + "); // Create a gap in the commits for us to insert our new commit with --before. test_env.jj_cmd_ok(&workspace_path, &["commit", "-m", "first"]); @@ -362,22 +362,22 @@ fn test_new_advance_bookmarks_before() { &workspace_path, &["bookmark", "create", "-r", "@---", "test_bookmark"], ); - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{} desc: third ○ bookmarks{} desc: second ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); test_env.jj_cmd_ok(&workspace_path, &["new", "--before", "@-"]); - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" ○ bookmarks{} desc: third @ bookmarks{} desc: ○ bookmarks{} desc: second ○ bookmarks{test_bookmark} desc: first ◆ bookmarks{} desc: - "###); + "); } // If the `--after` flag is passed to `jj new`, bookmarks are not advanced. @@ -394,18 +394,18 @@ fn test_new_advance_bookmarks_after() { ); // Check the initial state of the repo. - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ◆ bookmarks{test_bookmark} desc: - "###); + "); test_env.jj_cmd_ok(&workspace_path, &["describe", "-m", "first"]); test_env.jj_cmd_ok(&workspace_path, &["new", "--after", "@"]); - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ○ bookmarks{} desc: first ◆ bookmarks{test_bookmark} desc: - "###); + "); } #[test] @@ -430,20 +430,20 @@ fn test_new_advance_bookmarks_merge_children() { ); // Check the initial state of the repo. - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: 2 │ ○ bookmarks{} desc: 1 ├─╯ ○ bookmarks{test_bookmark} desc: 0 ◆ bookmarks{} desc: - "###); + "); // The bookmark won't advance because `jj new` had multiple targets. test_env.jj_cmd_ok( &workspace_path, &["new", "description(1)", "description(2)"], ); - insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output_with_bookmarks(&test_env, &workspace_path), @r" @ bookmarks{} desc: ├─╮ │ ○ bookmarks{} desc: 2 @@ -451,5 +451,5 @@ fn test_new_advance_bookmarks_merge_children() { ├─╯ ○ bookmarks{test_bookmark} desc: 0 ◆ bookmarks{} desc: - "###); + "); } diff --git a/cli/tests/test_alias.rs b/cli/tests/test_alias.rs index f1461eb1cc..69de148058 100644 --- a/cli/tests/test_alias.rs +++ b/cli/tests/test_alias.rs @@ -27,11 +27,11 @@ fn test_alias_basic() { test_env.add_config(r#"aliases.bk = ["log", "-r", "@", "-T", "bookmarks"]"#); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "my-bookmark"]); let stdout = test_env.jj_cmd_success(&repo_path, &["bk"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ my-bookmark │ ~ - "###); + "); } #[test] @@ -41,13 +41,13 @@ fn test_alias_bad_name() { let repo_path = test_env.env_root().join("repo"); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["foo."]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: unrecognized subcommand 'foo.' Usage: jj [OPTIONS] For more information, try '--help'. - "###); + "); } #[test] @@ -63,19 +63,15 @@ fn test_alias_calls_empty_command() { "#, ); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["empty"]); - insta::assert_snapshot!(stderr.lines().take(3).join("\n"), @r###" + insta::assert_snapshot!(stderr.lines().take(3).join("\n"), @r" Jujutsu (An experimental VCS) Usage: jj [OPTIONS] - "###); + "); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["empty", "--no-pager"]); - insta::assert_snapshot!(stderr.lines().next().unwrap_or_default(), @r###" - error: 'jj' requires a subcommand but one was not provided - "###); + insta::assert_snapshot!(stderr.lines().next().unwrap_or_default(), @"error: 'jj' requires a subcommand but one was not provided"); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["empty_command_with_opts"]); - insta::assert_snapshot!(stderr.lines().next().unwrap_or_default(), @r###" - error: 'jj' requires a subcommand but one was not provided - "###); + insta::assert_snapshot!(stderr.lines().next().unwrap_or_default(), @"error: 'jj' requires a subcommand but one was not provided"); } #[test] @@ -86,7 +82,7 @@ fn test_alias_calls_unknown_command() { test_env.add_config(r#"aliases.foo = ["nonexistent"]"#); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["foo"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: unrecognized subcommand 'nonexistent' tip: a similar subcommand exists: 'next' @@ -94,7 +90,7 @@ fn test_alias_calls_unknown_command() { Usage: jj [OPTIONS] For more information, try '--help'. - "###); + "); } #[test] @@ -105,7 +101,7 @@ fn test_alias_calls_command_with_invalid_option() { test_env.add_config(r#"aliases.foo = ["log", "--nonexistent"]"#); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["foo"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: unexpected argument '--nonexistent' found tip: to pass '--nonexistent' as a value, use '-- --nonexistent' @@ -113,7 +109,7 @@ fn test_alias_calls_command_with_invalid_option() { Usage: jj log [OPTIONS] [FILESETS]... For more information, try '--help'. - "###); + "); } #[test] @@ -123,13 +119,13 @@ fn test_alias_calls_help() { let repo_path = test_env.env_root().join("repo"); test_env.add_config(r#"aliases.h = ["--help"]"#); let stdout = test_env.jj_cmd_success(&repo_path, &["h"]); - insta::assert_snapshot!(stdout.lines().take(5).join("\n"), @r###" + insta::assert_snapshot!(stdout.lines().take(5).join("\n"), @r" Jujutsu (An experimental VCS) To get started, see the tutorial at https://jj-vcs.github.io/jj/latest/tutorial/. Usage: jj [OPTIONS] - "###); + "); } #[test] @@ -141,10 +137,8 @@ fn test_alias_cannot_override_builtin() { test_env.add_config(r#"aliases.log = ["rebase"]"#); // Alias should give a warning let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "-r", "root()"]); - insta::assert_snapshot!(stdout, @r###" - ◆ zzzzzzzz root() 00000000 - "###); - insta::assert_snapshot!(stderr, @"Warning: Cannot define an alias that overrides the built-in command 'log'\n"); + insta::assert_snapshot!(stdout, @"◆ zzzzzzzz root() 00000000"); + insta::assert_snapshot!(stderr, @"Warning: Cannot define an alias that overrides the built-in command 'log'"); } #[test] @@ -176,31 +170,25 @@ fn test_alias_global_args_before_and_after() { test_env.add_config(r#"aliases.l = ["log", "-T", "commit_id", "-r", "all()"]"#); // Test the setup let stdout = test_env.jj_cmd_success(&repo_path, &["l"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Can pass global args before let stdout = test_env.jj_cmd_success(&repo_path, &["l", "--at-op", "@-"]); - insta::assert_snapshot!(stdout, @r###" - ◆ 0000000000000000000000000000000000000000 - "###); + insta::assert_snapshot!(stdout, @"◆ 0000000000000000000000000000000000000000"); // Can pass global args after let stdout = test_env.jj_cmd_success(&repo_path, &["--at-op", "@-", "l"]); - insta::assert_snapshot!(stdout, @r###" - ◆ 0000000000000000000000000000000000000000 - "###); + insta::assert_snapshot!(stdout, @"◆ 0000000000000000000000000000000000000000"); // Test passing global args both before and after let stdout = test_env.jj_cmd_success(&repo_path, &["--at-op", "abc123", "l", "--at-op", "@-"]); - insta::assert_snapshot!(stdout, @r###" - ◆ 0000000000000000000000000000000000000000 - "###); + insta::assert_snapshot!(stdout, @"◆ 0000000000000000000000000000000000000000"); let stdout = test_env.jj_cmd_success(&repo_path, &["-R", "../nonexistent", "l", "-R", "."]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); } #[test] @@ -214,9 +202,7 @@ fn test_alias_global_args_in_definition() { // The global argument in the alias is respected let stdout = test_env.jj_cmd_success(&repo_path, &["l"]); - insta::assert_snapshot!(stdout, @r###" - ◆ 0000000000000000000000000000000000000000 - "###); + insta::assert_snapshot!(stdout, @"◆ 0000000000000000000000000000000000000000"); } #[test] @@ -266,22 +252,16 @@ fn test_alias_in_repo_config() { // In repo1 sub directory, aliases can be loaded from the repo1 config. let stdout = test_env.jj_cmd_success(&repo1_path.join("sub"), &["l"]); - insta::assert_snapshot!(stdout, @r###" - repo1 alias - "###); + insta::assert_snapshot!(stdout, @"repo1 alias"); // In repo2 directory, no repo-local aliases exist. let stdout = test_env.jj_cmd_success(&repo2_path, &["l"]); - insta::assert_snapshot!(stdout, @r###" - user alias - "###); + insta::assert_snapshot!(stdout, @"user alias"); // Aliases can't be loaded from the -R path due to chicken and egg problem. let (stdout, stderr) = test_env.jj_cmd_ok(&repo2_path, &["l", "-R", repo1_path.to_str().unwrap()]); - insta::assert_snapshot!(stdout, @r###" - user alias - "###); + insta::assert_snapshot!(stdout, @"user alias"); insta::assert_snapshot!( stderr, @"Warning: Command aliases cannot be loaded from -R/--repository path or --config/--config-file arguments."); @@ -289,9 +269,7 @@ fn test_alias_in_repo_config() { // Aliases are loaded from the cwd-relative workspace even with -R. let (stdout, stderr) = test_env.jj_cmd_ok(&repo1_path, &["l", "-R", repo2_path.to_str().unwrap()]); - insta::assert_snapshot!(stdout, @r###" - repo1 alias - "###); + insta::assert_snapshot!(stdout, @"repo1 alias"); insta::assert_snapshot!( stderr, @"Warning: Command aliases cannot be loaded from -R/--repository path or --config/--config-file arguments."); diff --git a/cli/tests/test_backout_command.rs b/cli/tests/test_backout_command.rs index 63e5a318f7..de4231338f 100644 --- a/cli/tests/test_backout_command.rs +++ b/cli/tests/test_backout_command.rs @@ -44,37 +44,33 @@ fn test_backout() { create_commit(&test_env, &repo_path, "a", &[], &[("a", "a\n")]); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 2443ea76b0b1 a ◆ 000000000000 - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" - A a - "###); + insta::assert_snapshot!(stdout, @"A a"); // Backout the commit let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["backout", "-r", "@"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" ○ 6d845ed9fb6a Back out "a" │ │ This backs out commit 2443ea76b0b1c531326908326aab7020abab8e6c. @ 2443ea76b0b1 a ◆ 000000000000 - "###); + "#); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@+"]); - insta::assert_snapshot!(stdout, @r###" - D a - "###); + insta::assert_snapshot!(stdout, @"D a"); // Backout the new backed-out commit test_env.jj_cmd_ok(&repo_path, &["edit", "@+"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["backout", "-r", "@"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" ○ 79555ea9040b Back out "Back out "a"" │ │ This backs out commit 6d845ed9fb6a3d367e2d7068ef0256b1a10705a9. @@ -83,11 +79,9 @@ fn test_backout() { │ This backs out commit 2443ea76b0b1c531326908326aab7020abab8e6c. ○ 2443ea76b0b1 a ◆ 000000000000 - "###); + "#); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@+"]); - insta::assert_snapshot!(stdout, @r###" - A a - "###); + insta::assert_snapshot!(stdout, @"A a"); } #[test] @@ -109,21 +103,21 @@ fn test_backout_multiple() { create_commit(&test_env, &repo_path, "e", &["d"], &[("a", "a\nb\nc\n")]); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 208f8612074a e ○ ceeec03be46b d ○ 413337bbd11f c ○ 46cc97af6802 b ○ 2443ea76b0b1 a ◆ 000000000000 - "###); + "); // Backout multiple commits let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["backout", "-r", "b", "-r", "c", "-r", "e"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" ○ 6504c4ded177 Back out "b" │ │ This backs out commit 46cc97af6802301d8db381386e8485ff3ff24ae6. @@ -139,7 +133,7 @@ fn test_backout_multiple() { ○ 46cc97af6802 b ○ 2443ea76b0b1 a ◆ 000000000000 - "###); + "#); // View the output of each backed out commit let stdout = test_env.jj_cmd_success(&repo_path, &["show", "@+"]); insta::assert_snapshot!(stdout, @r#" diff --git a/cli/tests/test_bookmark_command.rs b/cli/tests/test_bookmark_command.rs index 72e0200211..137759f280 100644 --- a/cli/tests/test_bookmark_command.rs +++ b/cli/tests/test_bookmark_command.rs @@ -24,62 +24,56 @@ fn test_bookmark_multiple_names() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "foo", "bar"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created 2 bookmarks pointing to qpvuntsm 230dd059 bar foo | (empty) (no description set) Hint: Use -r to specify the target revision. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ bar foo 230dd059e1b0 ◆ 000000000000 - "###); + "); test_env.jj_cmd_ok(&repo_path, &["new"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "foo", "bar"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Moved 2 bookmarks to zsuskuln 8bb159bc bar foo | (empty) (no description set) Hint: Use -r to specify the target revision. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ bar foo 8bb159bc30a9 ○ 230dd059e1b0 ◆ 000000000000 - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "delete", "foo", "bar", "foo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Deleted 2 bookmarks. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Deleted 2 bookmarks."); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 8bb159bc30a9 ○ 230dd059e1b0 ◆ 000000000000 - "###); + "); // Hint should be omitted if -r is specified let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "-r@-", "foo", "bar"]); - insta::assert_snapshot!(stderr, @r###" - Created 2 bookmarks pointing to qpvuntsm 230dd059 bar foo | (empty) (no description set) - "###); + insta::assert_snapshot!(stderr, @"Created 2 bookmarks pointing to qpvuntsm 230dd059 bar foo | (empty) (no description set)"); // Create and move with explicit -r let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "-r@", "bar", "baz"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created 1 bookmarks pointing to zsuskuln 8bb159bc bar baz | (empty) (no description set) Moved 1 bookmarks to zsuskuln 8bb159bc bar baz | (empty) (no description set) Hint: Consider using `jj bookmark move` if your intention was to move existing bookmarks. - "###); + "); // Noop changes should not be included in the stats let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "-r@", "foo", "bar", "baz"]); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to zsuskuln 8bb159bc bar baz foo | (empty) (no description set) - "###); + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to zsuskuln 8bb159bc bar baz foo | (empty) (no description set)"); } #[test] @@ -91,16 +85,14 @@ fn test_bookmark_at_root() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "fred", "-r=root()"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Created 1 bookmarks pointing to zzzzzzzz 00000000 fred | (empty) (no description set) - "###); + insta::assert_snapshot!(stderr, @"Created 1 bookmarks pointing to zzzzzzzz 00000000 fred | (empty) (no description set)"); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Nothing changed. Warning: Failed to export some bookmarks: fred: Ref cannot point to the root commit in Git - "###); + "); } #[test] @@ -110,18 +102,18 @@ fn test_bookmark_empty_name() { let repo_path = test_env.env_root().join("repo"); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "create", ""]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: a value is required for '...' but none was supplied For more information, try '--help'. - "###); + "); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "set", ""]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: a value is required for '...' but none was supplied For more information, try '--help'. - "###); + "); } #[test] @@ -139,98 +131,84 @@ fn test_bookmark_move() { ); let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "move", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Error: No such bookmark: foo - "###); + insta::assert_snapshot!(stderr, @"Error: No such bookmark: foo"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "foo"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created 1 bookmarks pointing to qpvuntsm 230dd059 foo | (empty) (no description set) Hint: Consider using `jj bookmark move` if your intention was to move existing bookmarks. - "###); + "); test_env.jj_cmd_ok(&repo_path, &["new"]); let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "create", "foo"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Bookmark already exists: foo Hint: Use `jj bookmark set` to update it. - "###); + "); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to mzvwutvl 167f90e7 foo | (empty) (no description set) - "###); + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to mzvwutvl 167f90e7 foo | (empty) (no description set)"); let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "set", "-r@-", "foo"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Refusing to move bookmark backwards or sideways: foo Hint: Use --allow-backwards to allow it. - "###); + "); let (_stdout, stderr) = test_env.jj_cmd_ok( &repo_path, &["bookmark", "set", "-r@-", "--allow-backwards", "foo"], ); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to qpvuntsm 230dd059 foo | (empty) (no description set) - "###); + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to qpvuntsm 230dd059 foo | (empty) (no description set)"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "move", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to mzvwutvl 167f90e7 foo | (empty) (no description set) - "###); + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to mzvwutvl 167f90e7 foo | (empty) (no description set)"); let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "move", "--to=@-", "foo"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Refusing to move bookmark backwards or sideways: foo Hint: Use --allow-backwards to allow it. - "###); + "); let (_stdout, stderr) = test_env.jj_cmd_ok( &repo_path, &["bookmark", "move", "--to=@-", "--allow-backwards", "foo"], ); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to qpvuntsm 230dd059 foo | (empty) (no description set) - "###); + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to qpvuntsm 230dd059 foo | (empty) (no description set)"); // Delete bookmark locally, but is still tracking remote test_env.jj_cmd_ok(&repo_path, &["describe", "@-", "-mcommit"]); test_env.jj_cmd_ok(&repo_path, &["git", "push", "--allow-new", "-r@-"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "delete", "foo"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" foo (deleted) @origin: qpvuntsm 1eb845f3 (empty) commit - "###); + "); // Deleted tracking bookmark name should still be allocated let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "create", "foo"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Tracked remote bookmarks exist for deleted bookmark: foo Hint: Use `jj bookmark set` to recreate the local bookmark. Run `jj bookmark untrack 'glob:foo@*'` to disassociate them. - "###); + "); // Restoring local target shouldn't invalidate tracking state let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to mzvwutvl 66d48752 foo* | (empty) (no description set) - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to mzvwutvl 66d48752 foo* | (empty) (no description set)"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" foo: mzvwutvl 66d48752 (empty) (no description set) @origin (behind by 1 commits): qpvuntsm 1eb845f3 (empty) commit - "###); + "); // Untracked remote bookmark shouldn't block creation of local bookmark test_env.jj_cmd_ok(&repo_path, &["bookmark", "untrack", "foo@origin"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "delete", "foo"]); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Created 1 bookmarks pointing to mzvwutvl 66d48752 foo | (empty) (no description set) - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Created 1 bookmarks pointing to mzvwutvl 66d48752 foo | (empty) (no description set)"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" foo: mzvwutvl 66d48752 (empty) (no description set) foo@origin: qpvuntsm 1eb845f3 (empty) commit - "###); + "); } #[test] @@ -246,7 +224,7 @@ fn test_bookmark_move_matching() { test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "c1"]); test_env.jj_cmd_ok(&repo_path, &["new", "-mhead2"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ a2781dd9ee37 ○ c1 f4f38657a3dd ○ b1 f652c32197cf @@ -254,45 +232,39 @@ fn test_bookmark_move_matching() { │ ○ a1 a2 230dd059e1b0 ├─╯ ◆ 000000000000 - "###); + "); // The default could be considered "--from=all() glob:*", but is disabled let stderr = test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "move"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: the following required arguments were not provided: <--from |NAMES> Usage: jj bookmark move <--from |NAMES> For more information, try '--help'. - "###); + "); // No bookmarks pointing to the source revisions let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "move", "--from=none()"]); - insta::assert_snapshot!(stderr, @r###" - No bookmarks to update. - "###); + insta::assert_snapshot!(stderr, @"No bookmarks to update."); // No matching bookmarks within the source revisions let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "move", "--from=::@", "glob:a?"]); - insta::assert_snapshot!(stderr, @r###" - Error: No matching bookmarks for patterns: a? - "###); + insta::assert_snapshot!(stderr, @"Error: No matching bookmarks for patterns: a?"); // Noop move let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "move", "--to=a1", "a2"]); - insta::assert_snapshot!(stderr, @r###" - No bookmarks to update. - "###); + insta::assert_snapshot!(stderr, @"No bookmarks to update."); // Move from multiple revisions let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "move", "--from=::@"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Moved 2 bookmarks to vruxwmqv a2781dd9 b1 c1 | (empty) head2 Hint: Specify bookmark by name to update just one of the bookmarks. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ b1 c1 a2781dd9ee37 ○ f4f38657a3dd ○ f652c32197cf @@ -300,16 +272,16 @@ fn test_bookmark_move_matching() { │ ○ a1 a2 230dd059e1b0 ├─╯ ◆ 000000000000 - "###); + "); test_env.jj_cmd_ok(&repo_path, &["undo"]); // Try to move multiple bookmarks, but one of them isn't fast-forward let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "move", "glob:?1"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Refusing to move bookmark backwards or sideways: a1 Hint: Use --allow-backwards to allow it. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ a2781dd9ee37 ○ c1 f4f38657a3dd ○ b1 f652c32197cf @@ -317,17 +289,15 @@ fn test_bookmark_move_matching() { │ ○ a1 a2 230dd059e1b0 ├─╯ ◆ 000000000000 - "###); + "); // Select by revision and name let (_stdout, stderr) = test_env.jj_cmd_ok( &repo_path, &["bookmark", "move", "--from=::a1+", "--to=a1+", "glob:?1"], ); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to kkmpptxz 6b5e840e a1 | (empty) head1 - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to kkmpptxz 6b5e840e a1 | (empty) head1"); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ a2781dd9ee37 ○ c1 f4f38657a3dd ○ b1 f652c32197cf @@ -335,7 +305,7 @@ fn test_bookmark_move_matching() { │ ○ a2 230dd059e1b0 ├─╯ ◆ 000000000000 - "###); + "); } #[test] @@ -369,7 +339,7 @@ fn test_bookmark_move_conflicting() { "foo", ], ); - insta::assert_snapshot!(get_log(), @r###" + insta::assert_snapshot!(get_log(), @r" @ A1 ○ A0 foo?? │ ○ C0 @@ -377,24 +347,22 @@ fn test_bookmark_move_conflicting() { │ ○ B0 foo?? ├─╯ ◆ - "###); + "); // Can't move the bookmark to C0 since it's sibling. let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "set", "-rdescription(C0)", "foo"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Refusing to move bookmark backwards or sideways: foo Hint: Use --allow-backwards to allow it. - "###); + "); // Can move the bookmark to A1 since it's descendant of A0. It's not // descendant of B0, though. let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "-rdescription(A1)", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to mzvwutvl 9328d344 foo | (empty) A1 - "###); - insta::assert_snapshot!(get_log(), @r###" + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to mzvwutvl 9328d344 foo | (empty) A1"); + insta::assert_snapshot!(get_log(), @r" @ A1 foo ○ A0 │ ○ C0 @@ -402,7 +370,7 @@ fn test_bookmark_move_conflicting() { │ ○ B0 ├─╯ ◆ - "###); + "); } #[test] @@ -420,9 +388,7 @@ fn test_bookmark_rename() { ); let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "rename", "bnoexist", "blocal"]); - insta::assert_snapshot!(stderr, @r###" - Error: No such bookmark: bnoexist - "###); + insta::assert_snapshot!(stderr, @"Error: No such bookmark: bnoexist"); test_env.jj_cmd_ok(&repo_path, &["describe", "-m=commit-0"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "blocal"]); @@ -434,9 +400,7 @@ fn test_bookmark_rename() { test_env.jj_cmd_ok(&repo_path, &["describe", "-m=commit-1"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "bexist"]); let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "rename", "blocal1", "bexist"]); - insta::assert_snapshot!(stderr, @r###" - Error: Bookmark already exists: bexist - "###); + insta::assert_snapshot!(stderr, @"Error: Bookmark already exists: bexist"); test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["describe", "-m=commit-2"]); @@ -444,16 +408,16 @@ fn test_bookmark_rename() { test_env.jj_cmd_ok(&repo_path, &["git", "push", "--allow-new", "-b=bremote"]); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "rename", "bremote", "bremote2"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Tracked remote bookmarks for bookmark bremote were not renamed. Hint: To rename the bookmark on the remote, you can `jj git push --bookmark bremote` first (to delete it on the remote), and then `jj git push --bookmark bremote2`. `jj git push --all` would also be sufficient. - "###); + "); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "rename", "bremote2", "bremote"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Tracked remote bookmarks for bookmark bremote exist. Hint: Run `jj bookmark untrack 'glob:bremote@*'` to disassociate them. - "###); + "); } #[test] @@ -482,27 +446,23 @@ fn test_bookmark_forget_glob() { test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "foo-3"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "foo-4"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ bar-2 foo-1 foo-3 foo-4 230dd059e1b0 ◆ 000000000000 - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "forget", "glob:foo-[1-3]"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Forgot 2 bookmarks. - "###); + insta::assert_snapshot!(stderr, @"Forgot 2 bookmarks."); test_env.jj_cmd_ok(&repo_path, &["undo"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "forget", "glob:foo-[1-3]"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Forgot 2 bookmarks. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Forgot 2 bookmarks."); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ bar-2 foo-4 230dd059e1b0 ◆ 000000000000 - "###); + "); // Forgetting a bookmark via both explicit name and glob pattern, or with // multiple glob patterns, shouldn't produce an error. @@ -511,30 +471,26 @@ fn test_bookmark_forget_glob() { &["bookmark", "forget", "foo-4", "glob:foo-*", "glob:foo-*"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Forgot 1 bookmarks. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Forgot 1 bookmarks."); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ bar-2 230dd059e1b0 ◆ 000000000000 - "###); + "); // Malformed glob let stderr = test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "forget", "glob:foo-[1-3"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: invalid value 'glob:foo-[1-3' for '...': Pattern syntax error near position 4: invalid range pattern For more information, try '--help'. - "###); + "); // We get an error if none of the globs match anything let stderr = test_env.jj_cmd_failure( &repo_path, &["bookmark", "forget", "glob:bar*", "glob:baz*", "glob:boom*"], ); - insta::assert_snapshot!(stderr, @r###" - Error: No matching bookmarks for patterns: baz*, boom* - "###); + insta::assert_snapshot!(stderr, @"Error: No matching bookmarks for patterns: baz*, boom*"); } #[test] @@ -563,34 +519,28 @@ fn test_bookmark_delete_glob() { // Push to create remote-tracking bookmarks test_env.jj_cmd_ok(&repo_path, &["git", "push", "--all"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ bar-2 foo-1 foo-3 foo-4 312a98d6f27b ◆ 000000000000 - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "delete", "glob:foo-[1-3]"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Deleted 2 bookmarks. - "###); + insta::assert_snapshot!(stderr, @"Deleted 2 bookmarks."); test_env.jj_cmd_ok(&repo_path, &["undo"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "delete", "glob:foo-[1-3]"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Deleted 2 bookmarks. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Deleted 2 bookmarks."); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ bar-2 foo-1@origin foo-3@origin foo-4 312a98d6f27b ◆ 000000000000 - "###); + "); // We get an error if none of the globs match live bookmarks. Unlike `jj // bookmark forget`, it's not allowed to delete already deleted bookmarks. let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "delete", "glob:foo-[1-3]"]); - insta::assert_snapshot!(stderr, @r###" - Error: No matching bookmarks for patterns: foo-[1-3] - "###); + insta::assert_snapshot!(stderr, @"Error: No matching bookmarks for patterns: foo-[1-3]"); // Deleting a bookmark via both explicit name and glob pattern, or with // multiple glob patterns, shouldn't produce an error. @@ -599,16 +549,14 @@ fn test_bookmark_delete_glob() { &["bookmark", "delete", "foo-4", "glob:foo-*", "glob:foo-*"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Deleted 1 bookmarks. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Deleted 1 bookmarks."); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ bar-2 foo-1@origin foo-3@origin foo-4@origin 312a98d6f27b ◆ 000000000000 - "###); + "); // The deleted bookmarks are still there - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" bar-2: qpvuntsm 312a98d6 (empty) commit @origin: qpvuntsm 312a98d6 (empty) commit foo-1 (deleted) @@ -617,15 +565,15 @@ fn test_bookmark_delete_glob() { @origin: qpvuntsm 312a98d6 (empty) commit foo-4 (deleted) @origin: qpvuntsm 312a98d6 (empty) commit - "###); + "); // Malformed glob let stderr = test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "delete", "glob:foo-[1-3"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: invalid value 'glob:foo-[1-3' for '...': Pattern syntax error near position 4: invalid range pattern For more information, try '--help'. - "###); + "); // Unknown pattern kind let stderr = @@ -650,17 +598,14 @@ fn test_bookmark_delete_export() { test_env.jj_cmd_ok(&repo_path, &["bookmark", "delete", "foo"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "list", "--all-remotes"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" foo (deleted) @git: rlvkpnrz 65b6b74e (empty) (no description set) - "###); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be deleted from the underlying Git repo on the next `jj git export`. - "###); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be deleted from the underlying Git repo on the next `jj git export`."); test_env.jj_cmd_ok(&repo_path, &["git", "export"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" - "###); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @""); } #[test] @@ -671,9 +616,7 @@ fn test_bookmark_forget_export() { test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "foo"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" - foo: rlvkpnrz 65b6b74e (empty) (no description set) - "###); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"foo: rlvkpnrz 65b6b74e (empty) (no description set)"); // Exporting the bookmark to git creates a local-git tracking bookmark let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); @@ -681,9 +624,7 @@ fn test_bookmark_forget_export() { insta::assert_snapshot!(stderr, @""); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "forget", "foo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Forgot 1 bookmarks. - "###); + insta::assert_snapshot!(stderr, @"Forgot 1 bookmarks."); // Forgetting a bookmark deletes local and remote-tracking bookmarks including // the corresponding git-tracking bookmark. insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @""); @@ -739,10 +680,10 @@ fn test_bookmark_forget_fetched_bookmark() { // Fetch normally test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message - "###); + "); // TEST 1: with export-import // Forget the bookmark @@ -762,21 +703,17 @@ fn test_bookmark_forget_fetched_bookmark() { insta::assert_snapshot!(stderr, @""); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @""); // We can fetch feature1 again. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - bookmark: feature1@origin [new] tracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"bookmark: feature1@origin [new] tracked"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message - "###); + "); // TEST 2: No export/import (otherwise the same as test 1) test_env.jj_cmd_ok(&repo_path, &["bookmark", "forget", "feature1"]); @@ -784,13 +721,11 @@ fn test_bookmark_forget_fetched_bookmark() { // Fetch works even without the export-import let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - bookmark: feature1@origin [new] tracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"bookmark: feature1@origin [new] tracked"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message - "###); + "); // TEST 3: fetch bookmark that was moved & forgotten @@ -807,20 +742,16 @@ fn test_bookmark_forget_fetched_bookmark() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "forget", "feature1"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Forgot 1 bookmarks. - "###); + insta::assert_snapshot!(stderr, @"Forgot 1 bookmarks."); // Fetching a moved bookmark does not create a conflict let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - bookmark: feature1@origin [new] tracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"bookmark: feature1@origin [new] tracked"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: ooosovrs 38aefb17 (empty) another message @origin: ooosovrs 38aefb17 (empty) another message - "###); + "); } #[test] @@ -864,10 +795,10 @@ fn test_bookmark_forget_deleted_or_nonexistent_bookmark() { // Fetch and then delete the bookmark test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "delete", "feature1"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1 (deleted) @origin: mzyxwzks 9f01a0e0 message - "###); + "); // ============ End of test setup ============ @@ -877,9 +808,7 @@ fn test_bookmark_forget_deleted_or_nonexistent_bookmark() { // Can't forget a non-existent bookmark let stderr = test_env.jj_cmd_failure(&repo_path, &["bookmark", "forget", "i_do_not_exist"]); - insta::assert_snapshot!(stderr, @r###" - Error: No such bookmark: i_do_not_exist - "###); + insta::assert_snapshot!(stderr, @"Error: No such bookmark: i_do_not_exist"); } #[test] @@ -928,40 +857,40 @@ fn test_bookmark_track_untrack() { ); test_env.add_config("git.auto-local-bookmark = false"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: feature1@origin [new] untracked bookmark: feature2@origin [new] untracked bookmark: main@origin [new] untracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1@origin: sptzoqmo 7b33f629 commit 1 feature2@origin: sptzoqmo 7b33f629 commit 1 main@origin: sptzoqmo 7b33f629 commit 1 - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 230dd059e1b0 │ ◆ feature1@origin feature2@origin main@origin 7b33f6295eda ├─╯ ◆ 000000000000 - "#); + "); // Track new bookmark. Local bookmark should be created. test_env.jj_cmd_ok( &repo_path, &["bookmark", "track", "feature1@origin", "main@origin"], ); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: sptzoqmo 7b33f629 commit 1 @origin: sptzoqmo 7b33f629 commit 1 feature2@origin: sptzoqmo 7b33f629 commit 1 main: sptzoqmo 7b33f629 commit 1 @origin: sptzoqmo 7b33f629 commit 1 - "###); + "); // Track existing bookmark. Local bookmark should result in conflict. test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "feature2"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "track", "feature2@origin"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: sptzoqmo 7b33f629 commit 1 @origin: sptzoqmo 7b33f629 commit 1 feature2 (conflicted): @@ -970,7 +899,7 @@ fn test_bookmark_track_untrack() { @origin (behind by 1 commits): sptzoqmo 7b33f629 commit 1 main: sptzoqmo 7b33f629 commit 1 @origin: sptzoqmo 7b33f629 commit 1 - "###); + "); // Untrack existing and locally-deleted bookmarks. Bookmark targets should be // unchanged @@ -979,19 +908,19 @@ fn test_bookmark_track_untrack() { &repo_path, &["bookmark", "untrack", "feature1@origin", "feature2@origin"], ); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: sptzoqmo 7b33f629 commit 1 feature1@origin: sptzoqmo 7b33f629 commit 1 feature2@origin: sptzoqmo 7b33f629 commit 1 main: sptzoqmo 7b33f629 commit 1 @origin: sptzoqmo 7b33f629 commit 1 - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 230dd059e1b0 │ ◆ feature1 feature1@origin feature2@origin main 7b33f6295eda ├─╯ ◆ 000000000000 - "#); + "); // Fetch new commit. Only tracking bookmark "main" should be merged. create_remote_commit( @@ -1004,26 +933,26 @@ fn test_bookmark_track_untrack() { ], ); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: feature1@origin [updated] untracked bookmark: feature2@origin [updated] untracked bookmark: main@origin [updated] tracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: sptzoqmo 7b33f629 commit 1 feature1@origin: mmqqkyyt 40dabdaf commit 2 feature2@origin: mmqqkyyt 40dabdaf commit 2 main: mmqqkyyt 40dabdaf commit 2 @origin: mmqqkyyt 40dabdaf commit 2 - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 230dd059e1b0 │ ◆ feature1@origin feature2@origin main 40dabdaf4abe ├─╯ │ ○ feature1 7b33f6295eda ├─╯ ◆ 000000000000 - "#); + "); // Fetch new commit with auto tracking. Tracking bookmark "main" and new // bookmark "feature3" should be merged. @@ -1039,14 +968,14 @@ fn test_bookmark_track_untrack() { ); test_env.add_config("git.auto-local-bookmark = true"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: feature1@origin [updated] untracked bookmark: feature2@origin [updated] untracked bookmark: feature3@origin [new] tracked bookmark: main@origin [updated] tracked Abandoned 1 commits that are no longer reachable. - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: sptzoqmo 7b33f629 commit 1 feature1@origin: wwnpyzpo 3f0f86fa commit 3 feature2@origin: wwnpyzpo 3f0f86fa commit 3 @@ -1054,15 +983,15 @@ fn test_bookmark_track_untrack() { @origin: wwnpyzpo 3f0f86fa commit 3 main: wwnpyzpo 3f0f86fa commit 3 @origin: wwnpyzpo 3f0f86fa commit 3 - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 230dd059e1b0 │ ◆ feature1@origin feature2@origin feature3 main 3f0f86fa0e57 ├─╯ │ ○ feature1 7b33f6295eda ├─╯ ◆ 000000000000 - "#); + "); } #[test] @@ -1086,13 +1015,13 @@ fn test_bookmark_track_conflict() { &["describe", "-m", "b", "-r", "main", "--ignore-immutable"], ); let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "track", "main@origin"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Started tracking 1 remote bookmarks. main (conflicted): + qpvuntsm e802c4f8 (empty) b + qpvuntsm hidden 427890ea (empty) a @origin (behind by 1 commits): qpvuntsm hidden 427890ea (empty) a - "###); + "); } #[test] @@ -1130,96 +1059,86 @@ fn test_bookmark_track_untrack_patterns() { // Fetch new commit without auto tracking test_env.add_config("git.auto-local-bookmark = false"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: feature1@origin [new] untracked bookmark: feature2@origin [new] untracked - "###); + "); // Track local bookmark test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "main"]); insta::assert_snapshot!( - test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "track", "main"]), @r###" + test_env.jj_cmd_cli_error(&repo_path, &["bookmark", "track", "main"]), @r" error: invalid value 'main' for '...': remote bookmark must be specified in bookmark@remote form For more information, try '--help'. - "###); + "); // Track/untrack unknown bookmark insta::assert_snapshot!( - test_env.jj_cmd_failure(&repo_path, &["bookmark", "track", "main@origin"]), @r###" - Error: No such remote bookmark: main@origin - "###); + test_env.jj_cmd_failure(&repo_path, &["bookmark", "track", "main@origin"]), @"Error: No such remote bookmark: main@origin"); insta::assert_snapshot!( - test_env.jj_cmd_failure(&repo_path, &["bookmark", "untrack", "main@origin"]), @r###" - Error: No such remote bookmark: main@origin - "###); + test_env.jj_cmd_failure(&repo_path, &["bookmark", "untrack", "main@origin"]), @"Error: No such remote bookmark: main@origin"); insta::assert_snapshot!( - test_env.jj_cmd_failure(&repo_path, &["bookmark", "track", "glob:maine@*"]), @r###" - Error: No matching remote bookmarks for patterns: maine@* - "###); + test_env.jj_cmd_failure(&repo_path, &["bookmark", "track", "glob:maine@*"]), @"Error: No matching remote bookmarks for patterns: maine@*"); insta::assert_snapshot!( test_env.jj_cmd_failure( &repo_path, &["bookmark", "untrack", "main@origin", "glob:main@o*"], - ), @r###" - Error: No matching remote bookmarks for patterns: main@origin, main@o* - "###); + ), @"Error: No matching remote bookmarks for patterns: main@origin, main@o*"); // Track already tracked bookmark test_env.jj_cmd_ok(&repo_path, &["bookmark", "track", "feature1@origin"]); let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "track", "feature1@origin"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Remote bookmark already tracked: feature1@origin Nothing changed. - "###); + "); // Untrack non-tracking bookmark let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "untrack", "feature2@origin"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Remote bookmark not tracked yet: feature2@origin Nothing changed. - "###); + "); // Untrack Git-tracking bookmark test_env.jj_cmd_ok(&repo_path, &["git", "export"]); let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "untrack", "main@git"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Git-tracking bookmark cannot be untracked: main@git Nothing changed. - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: omvolwpu 1336caed commit @git: omvolwpu 1336caed commit @origin: omvolwpu 1336caed commit feature2@origin: omvolwpu 1336caed commit main: qpvuntsm 230dd059 (empty) (no description set) @git: qpvuntsm 230dd059 (empty) (no description set) - "###); + "); // Untrack by pattern let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "untrack", "glob:*@*"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Git-tracking bookmark cannot be untracked: feature1@git Warning: Remote bookmark not tracked yet: feature2@origin Warning: Git-tracking bookmark cannot be untracked: main@git Stopped tracking 1 remote bookmarks. - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: omvolwpu 1336caed commit @git: omvolwpu 1336caed commit feature1@origin: omvolwpu 1336caed commit feature2@origin: omvolwpu 1336caed commit main: qpvuntsm 230dd059 (empty) (no description set) @git: qpvuntsm 230dd059 (empty) (no description set) - "###); + "); // Track by pattern let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "track", "glob:feature?@origin"]); - insta::assert_snapshot!(stderr, @r###" - Started tracking 2 remote bookmarks. - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Started tracking 2 remote bookmarks."); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: omvolwpu 1336caed commit @git: omvolwpu 1336caed commit @origin: omvolwpu 1336caed commit @@ -1227,7 +1146,7 @@ fn test_bookmark_track_untrack_patterns() { @origin: omvolwpu 1336caed commit main: qpvuntsm 230dd059 (empty) (no description set) @git: qpvuntsm 230dd059 (empty) (no description set) - "###); + "); } #[test] @@ -1276,20 +1195,18 @@ fn test_bookmark_list() { // Synchronized tracking remotes and non-tracking remotes aren't listed by // default let (stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["bookmark", "list"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-only: wqnwkozp 4e887f78 (empty) local-only remote-delete (deleted) @origin: mnmymoky 203e60eb (empty) remote-delete remote-sync: zwtyzrop c761c7ea (empty) remote-sync remote-unsync: wqnwkozp 4e887f78 (empty) local-only @origin (ahead by 1 commits, behind by 1 commits): qpsqxpyq 38ef8af7 (empty) remote-unsync - "###); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); let (stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["bookmark", "list", "--all-remotes"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-only: wqnwkozp 4e887f78 (empty) local-only remote-delete (deleted) @origin: mnmymoky 203e60eb (empty) remote-delete @@ -1298,10 +1215,8 @@ fn test_bookmark_list() { remote-unsync: wqnwkozp 4e887f78 (empty) local-only @origin (ahead by 1 commits, behind by 1 commits): qpsqxpyq 38ef8af7 (empty) remote-unsync remote-untrack@origin: vmortlor 71a16b05 (empty) remote-untrack - "###); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); let template = r#" concat( @@ -1321,7 +1236,7 @@ fn test_bookmark_list() { &local_path, &["bookmark", "list", "--all-remotes", "-T", template], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" [local-only] present: true conflict: false @@ -1402,10 +1317,8 @@ fn test_bookmark_list() { tracking_present: false tracking_ahead_count: tracking_behind_count: - "###); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); } #[test] @@ -1445,7 +1358,7 @@ fn test_bookmark_list_filtered() { &local_path, &["log", "-r::(bookmarks() | remote_bookmarks())", "-T", template], ), - @r#" + @r" @ c7b4c09cd77c local-keep │ ○ e31634b64294 remote-rewrite* ├─╯ @@ -1456,21 +1369,19 @@ fn test_bookmark_list_filtered() { │ ○ 911e912015fb remote-keep ├─╯ ◆ 000000000000 - "#); + "); // All bookmarks are listed by default. let (stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["bookmark", "list"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-keep: kpqxywon c7b4c09c (empty) local-keep remote-delete (deleted) @origin: yxusvupt dad5f298 (empty) remote-delete remote-keep: nlwprzpn 911e9120 (empty) remote-keep remote-rewrite: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "###); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); let query = |args: &[&str]| test_env.jj_cmd_ok(&local_path, &[&["bookmark", "list"], args].concat()); @@ -1481,81 +1392,79 @@ fn test_bookmark_list_filtered() { // "all()" doesn't include deleted bookmarks since they have no local targets. // So "all()" is identical to "bookmarks()". let (stdout, stderr) = query(&["-rall()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-keep: kpqxywon c7b4c09c (empty) local-keep remote-keep: nlwprzpn 911e9120 (empty) remote-keep remote-rewrite: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "###); + "); insta::assert_snapshot!(stderr, @""); // Exclude remote-only bookmarks. "remote-rewrite@origin" is included since // local "remote-rewrite" target matches. let (stdout, stderr) = query(&["-rbookmarks()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-keep: kpqxywon c7b4c09c (empty) local-keep remote-keep: nlwprzpn 911e9120 (empty) remote-keep remote-rewrite: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "###); + "); insta::assert_snapshot!(stderr, @""); // Select bookmarks by name. let (stdout, stderr) = query(&["remote-rewrite"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" remote-rewrite: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "###); + "); insta::assert_snapshot!(stderr, @""); let (stdout, stderr) = query(&["-rbookmarks(remote-rewrite)"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" remote-rewrite: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "###); + "); insta::assert_snapshot!(stderr, @""); // Select bookmarks by name, combined with --all-remotes test_env.jj_cmd_ok(&local_path, &["git", "export"]); let (stdout, stderr) = query(&["--all-remotes", "remote-rewrite"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" remote-rewrite: xyxluytn e31634b6 (empty) rewritten @git: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "###); + "); insta::assert_snapshot!(stderr, @""); let (stdout, stderr) = query(&["--all-remotes", "-rbookmarks(remote-rewrite)"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" remote-rewrite: xyxluytn e31634b6 (empty) rewritten @git: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "###); + "); insta::assert_snapshot!(stderr, @""); // Select bookmarks with --remote let (stdout, stderr) = query(&["--remote", "origin"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" remote-delete (deleted) @origin: yxusvupt dad5f298 (empty) remote-delete remote-keep: nlwprzpn 911e9120 (empty) remote-keep @origin: nlwprzpn 911e9120 (empty) remote-keep remote-rewrite: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "#); - insta::assert_snapshot!(stderr, @r#" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "#); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); let (stdout, stderr) = query(&["--remote", "glob:gi?"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" local-keep: kpqxywon c7b4c09c (empty) local-keep @git: kpqxywon c7b4c09c (empty) local-keep remote-keep: nlwprzpn 911e9120 (empty) remote-keep @git: nlwprzpn 911e9120 (empty) remote-keep remote-rewrite: xyxluytn e31634b6 (empty) rewritten @git: xyxluytn e31634b6 (empty) rewritten - "#); + "); insta::assert_snapshot!(stderr, @""); let (stdout, stderr) = query(&["--remote", "origin", "--remote", "git"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" local-keep: kpqxywon c7b4c09c (empty) local-keep @git: kpqxywon c7b4c09c (empty) local-keep remote-delete (deleted) @@ -1566,23 +1475,18 @@ fn test_bookmark_list_filtered() { remote-rewrite: xyxluytn e31634b6 (empty) rewritten @git: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "#); - insta::assert_snapshot!(stderr, @r#" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "#); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); // Can select deleted bookmark by name pattern, but not by revset. let (stdout, stderr) = query(&["remote-delete"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" remote-delete (deleted) @origin: yxusvupt dad5f298 (empty) remote-delete - "###); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); let (stdout, stderr) = query(&["-rbookmarks(remote-delete)"]); - insta::assert_snapshot!(stdout, @r###" - "###); + insta::assert_snapshot!(stdout, @""); 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`? @@ -1591,30 +1495,26 @@ fn test_bookmark_list_filtered() { // Name patterns are OR-ed. let (stdout, stderr) = query(&["glob:*-keep", "remote-delete"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-keep: kpqxywon c7b4c09c (empty) local-keep remote-delete (deleted) @origin: yxusvupt dad5f298 (empty) remote-delete remote-keep: nlwprzpn 911e9120 (empty) remote-keep - "###); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); // Unmatched name pattern shouldn't be an error. A warning can be added later. let (stdout, stderr) = query(&["local-keep", "glob:push-*"]); - insta::assert_snapshot!(stdout, @r###" - local-keep: kpqxywon c7b4c09c (empty) local-keep - "###); + insta::assert_snapshot!(stdout, @"local-keep: kpqxywon c7b4c09c (empty) local-keep"); insta::assert_snapshot!(stderr, @""); // Name pattern and revset are OR-ed. let (stdout, stderr) = query(&["local-keep", "-rbookmarks(remote-rewrite)"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-keep: kpqxywon c7b4c09c (empty) local-keep remote-rewrite: xyxluytn e31634b6 (empty) rewritten @origin (ahead by 1 commits, behind by 1 commits): xyxluytn hidden 3e9a5af6 (empty) remote-rewrite - "###); + "); insta::assert_snapshot!(stderr, @""); // … but still filtered by --remote @@ -1624,12 +1524,12 @@ fn test_bookmark_list_filtered() { "--remote", "git", ]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" local-keep: kpqxywon c7b4c09c (empty) local-keep @git: kpqxywon c7b4c09c (empty) local-keep remote-rewrite: xyxluytn e31634b6 (empty) rewritten @git: xyxluytn e31634b6 (empty) rewritten - "#); + "); insta::assert_snapshot!(stderr, @""); } @@ -1670,11 +1570,11 @@ fn test_bookmark_list_much_remote_divergence() { ); let (stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["bookmark", "list"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-only: zkyosouw 4ab3f751 (empty) local-only remote-unsync: zkyosouw 4ab3f751 (empty) local-only @origin (ahead by at least 10 commits, behind by at least 10 commits): lxyktnks 19582022 (empty) remote-unsync - "###); + "); insta::assert_snapshot!(stderr, @""); } @@ -1768,7 +1668,7 @@ fn test_bookmark_list_tracked() { ); let (stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["bookmark", "list", "--all-remotes"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" local-only: nmzmmopx e1da745b (empty) local-only @git: nmzmmopx e1da745b (empty) local-only remote-delete (deleted) @@ -1784,13 +1684,11 @@ fn test_bookmark_list_tracked() { upstream-sync: lolpmnqw 32fa6da0 (empty) upstream-sync @git: lolpmnqw 32fa6da0 (empty) upstream-sync @upstream: lolpmnqw 32fa6da0 (empty) upstream-sync - "###); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + "); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); let (stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["bookmark", "list", "--tracked"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" remote-delete (deleted) @origin: mnmymoky 203e60eb (empty) remote-delete remote-sync: zwtyzrop c761c7ea (empty) remote-sync @@ -1800,38 +1698,34 @@ fn test_bookmark_list_tracked() { @upstream (ahead by 1 commits, behind by 1 commits): qpsqxpyq 38ef8af7 (empty) remote-unsync upstream-sync: lolpmnqw 32fa6da0 (empty) upstream-sync @upstream: lolpmnqw 32fa6da0 (empty) upstream-sync - "### + " ); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); let (stdout, stderr) = test_env.jj_cmd_ok( &local_path, &["bookmark", "list", "--tracked", "--remote", "origin"], ); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" remote-delete (deleted) @origin: mnmymoky 203e60eb (empty) remote-delete remote-sync: zwtyzrop c761c7ea (empty) remote-sync @origin: zwtyzrop c761c7ea (empty) remote-sync remote-unsync: nmzmmopx e1da745b (empty) local-only @origin (ahead by 1 commits, behind by 1 commits): qpsqxpyq 38ef8af7 (empty) remote-unsync - "# + " ); - insta::assert_snapshot!(stderr, @r###" - Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this. - "###); + insta::assert_snapshot!(stderr, @"Hint: Bookmarks marked as deleted will be *deleted permanently* on the remote on the next `jj git push`. Use `jj bookmark forget` to prevent this."); let (stdout, stderr) = test_env.jj_cmd_ok( &local_path, &["bookmark", "list", "--tracked", "remote-unsync"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" remote-unsync: nmzmmopx e1da745b (empty) local-only @origin (ahead by 1 commits, behind by 1 commits): qpsqxpyq 38ef8af7 (empty) remote-unsync @upstream (ahead by 1 commits, behind by 1 commits): qpsqxpyq 38ef8af7 (empty) remote-unsync - "###); + "); insta::assert_snapshot!(stderr, @""); let (stdout, stderr) = test_env.jj_cmd_ok( @@ -1850,10 +1744,10 @@ fn test_bookmark_list_tracked() { &local_path, &["bookmark", "list", "--tracked", "remote-unsync"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" remote-unsync: nmzmmopx e1da745b (empty) local-only @origin (ahead by 1 commits, behind by 1 commits): qpsqxpyq 38ef8af7 (empty) remote-unsync - "###); + "); insta::assert_snapshot!(stderr, @""); } @@ -1883,17 +1777,17 @@ fn test_bookmark_list_conflicted() { ], ); test_env.jj_cmd_ok(&repo_path, &["status"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" bar: kkmpptxz 06a973bc (empty) b foo (conflicted): + rlvkpnrz d8d5f980 (empty) a + kkmpptxz 06a973bc (empty) b - "###); - insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["bookmark", "list", "--conflicted"]), @r###" + "); + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["bookmark", "list", "--conflicted"]), @r" foo (conflicted): + rlvkpnrz d8d5f980 (empty) a + kkmpptxz 06a973bc (empty) b - "###); + "); } fn get_log_output(test_env: &TestEnvironment, cwd: &Path) -> String { diff --git a/cli/tests/test_builtin_aliases.rs b/cli/tests/test_builtin_aliases.rs index f62d469cc6..d795baef3f 100644 --- a/cli/tests/test_builtin_aliases.rs +++ b/cli/tests/test_builtin_aliases.rs @@ -51,11 +51,11 @@ fn test_builtin_alias_trunk_matches_main() { let (test_env, workspace_root) = set_up("main"); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ◆ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd │ (empty) description 1 ~ - "###); + "); } #[test] @@ -63,11 +63,11 @@ fn test_builtin_alias_trunk_matches_master() { let (test_env, workspace_root) = set_up("master"); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ◆ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 master d13ecdbd │ (empty) description 1 ~ - "###); + "); } #[test] @@ -75,11 +75,11 @@ fn test_builtin_alias_trunk_matches_trunk() { let (test_env, workspace_root) = set_up("trunk"); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ◆ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 trunk d13ecdbd │ (empty) description 1 ~ - "###); + "); } #[test] @@ -90,11 +90,11 @@ fn test_builtin_alias_trunk_matches_exactly_one_commit() { test_env.jj_cmd_ok(&origin_path, &["bookmark", "create", "master"]); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ◆ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd │ (empty) description 1 ~ - "###); + "); } #[test] @@ -106,11 +106,11 @@ fn test_builtin_alias_trunk_override_alias() { ); let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-r", "trunk()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ◆ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 override-trunk d13ecdbd │ (empty) description 1 ~ - "###); + "); } #[test] @@ -118,11 +118,8 @@ fn test_builtin_alias_trunk_no_match() { let (test_env, workspace_root) = set_up("no-match-trunk"); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-r", "trunk()"]); - insta::assert_snapshot!(stdout, @r###" - ◆ zzzzzzzz root() 00000000 - "###); - insta::assert_snapshot!(stderr, @r###" - "###); + insta::assert_snapshot!(stdout, @"◆ zzzzzzzz root() 00000000"); + insta::assert_snapshot!(stderr, @""); } #[test] @@ -130,11 +127,8 @@ fn test_builtin_alias_trunk_no_match_only_exact() { let (test_env, workspace_root) = set_up("maint"); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-r", "trunk()"]); - insta::assert_snapshot!(stdout, @r###" - ◆ zzzzzzzz root() 00000000 - "###); - insta::assert_snapshot!(stderr, @r###" - "###); + insta::assert_snapshot!(stdout, @"◆ zzzzzzzz root() 00000000"); + insta::assert_snapshot!(stderr, @""); } #[test] @@ -146,11 +140,11 @@ fn test_builtin_user_redefines_builtin_immutable_heads() { test_env.add_config(r#"revset-aliases.'immutable()' = '@'"#); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-r", "trunk()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ○ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 main d13ecdbd │ (empty) description 1 ~ - "###); + "); insta::assert_snapshot!(stderr, @r" Warning: Redefining `revset-aliases.builtin_immutable_heads()` is not recommended; redefine `immutable_heads()` instead Warning: Redefining `revset-aliases.mutable()` is not recommended; redefine `immutable_heads()` instead diff --git a/cli/tests/test_commit_command.rs b/cli/tests/test_commit_command.rs index 135130f82e..c781d4693b 100644 --- a/cli/tests/test_commit_command.rs +++ b/cli/tests/test_commit_command.rs @@ -25,11 +25,11 @@ fn test_commit_with_description_from_cli() { // Description applies to the current working-copy (not the new one) test_env.jj_cmd_ok(&workspace_path, &["commit", "-m=first"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ e8ea92a8b6b3 ○ fa15625b4a98 first ◆ 000000000000 - "###); + "); } #[test] @@ -44,17 +44,17 @@ fn test_commit_with_editor() { let edit_script = test_env.set_up_fake_editor(); std::fs::write(&edit_script, ["dump editor0", "write\nmodified"].join("\0")).unwrap(); test_env.jj_cmd_ok(&workspace_path, &["commit"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ a57b2c95fb75 ○ 159271101e05 modified ◆ 000000000000 - "###); + "); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r#" initial JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); // Check that the editor content includes diff summary std::fs::write(workspace_path.join("file1"), "foo\n").unwrap(); @@ -63,7 +63,7 @@ fn test_commit_with_editor() { std::fs::write(&edit_script, "dump editor1").unwrap(); test_env.jj_cmd_ok(&workspace_path, &["commit"]); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor1")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor1")).unwrap(), @r#" add files JJ: This commit contains the following changes: @@ -71,7 +71,7 @@ fn test_commit_with_editor() { JJ: A file2 JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); } #[test] @@ -112,23 +112,23 @@ fn test_commit_interactive() { test_env.jj_cmd_ok(&workspace_path, &["commit", "-i"]); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("instrs")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("instrs")).unwrap(), @r" You are splitting the working-copy commit: qpvuntsm 4219467e add files The diff initially shows all changes. Adjust the right side until it shows the contents you want for the first commit. The remainder will be included in the new working-copy commit. - "###); + "); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" add files JJ: This commit contains the following changes: JJ: A file1 JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); // Try again with --tool=, which implies --interactive test_env.jj_cmd_ok(&workspace_path, &["undo"]); @@ -142,14 +142,14 @@ fn test_commit_interactive() { ); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" add files JJ: This commit contains the following changes: JJ: A file1 JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); let stdout = test_env.jj_cmd_success(&workspace_path, &["log", "--summary"]); insta::assert_snapshot!(stdout, @r" @@ -235,13 +235,13 @@ fn test_commit_with_default_description() { std::fs::write(edit_script, ["dump editor"].join("\0")).unwrap(); test_env.jj_cmd_ok(&workspace_path, &["commit"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_path), @r" @ c65242099289 ○ 573b6df51aea TESTED=TODO ◆ 000000000000 - "###); + "); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" TESTED=TODO JJ: This commit contains the following changes: @@ -249,7 +249,7 @@ fn test_commit_with_default_description() { JJ: A file2 JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); } #[test] @@ -288,7 +288,7 @@ fn test_commit_with_description_template() { // Only file1 should be included in the diff test_env.jj_cmd_ok(&workspace_path, &["commit", "file1"]); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" JJ: Author: Test User (2001-02-03 08:05:08) JJ: Committer: Test User (2001-02-03 08:05:08) @@ -296,7 +296,7 @@ fn test_commit_with_description_template() { JJ: 1 file changed, 1 insertion(+), 0 deletions(-) JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); // Only file2 with modified author should be included in the diff test_env.jj_cmd_ok( @@ -309,7 +309,7 @@ fn test_commit_with_description_template() { ], ); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" JJ: Author: Another User (2001-02-03 08:05:08) JJ: Committer: Test User (2001-02-03 08:05:09) @@ -317,12 +317,12 @@ fn test_commit_with_description_template() { JJ: 1 file changed, 1 insertion(+), 0 deletions(-) JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); // Timestamp after the reset should be available to the template test_env.jj_cmd_ok(&workspace_path, &["commit", "--reset-author"]); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" JJ: Author: Test User (2001-02-03 08:05:10) JJ: Committer: Test User (2001-02-03 08:05:10) @@ -330,7 +330,7 @@ fn test_commit_with_description_template() { JJ: 1 file changed, 1 insertion(+), 0 deletions(-) JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); } #[test] @@ -341,9 +341,7 @@ fn test_commit_without_working_copy() { test_env.jj_cmd_ok(&workspace_path, &["workspace", "forget"]); let stderr = test_env.jj_cmd_failure(&workspace_path, &["commit", "-m=first"]); - insta::assert_snapshot!(stderr, @r###" - Error: This command requires a working copy - "###); + insta::assert_snapshot!(stderr, @"Error: This command requires a working copy"); } #[test] @@ -357,13 +355,13 @@ fn test_commit_paths() { test_env.jj_cmd_ok(&workspace_path, &["commit", "-m=first", "file1"]); let stdout = test_env.jj_cmd_success(&workspace_path, &["diff", "-r", "@-"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Added regular file file1: 1: foo - "###); + "); let stdout = test_env.jj_cmd_success(&workspace_path, &["diff"]); - insta::assert_snapshot!(stdout, @" + insta::assert_snapshot!(stdout, @r" Added regular file file2: 1: bar "); @@ -379,20 +377,20 @@ fn test_commit_paths_warning() { std::fs::write(workspace_path.join("file2"), "bar\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["commit", "-m=first", "file3"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: The given paths do not match any file: file3 Working copy now at: rlvkpnrz d1872100 (no description set) Parent commit : qpvuntsm fa15625b (empty) first - "###); + "); insta::assert_snapshot!(stdout, @""); let stdout = test_env.jj_cmd_success(&workspace_path, &["diff"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Added regular file file1: 1: foo Added regular file file2: 1: bar - "###); + "); } #[test] @@ -416,11 +414,11 @@ fn test_commit_reset_author() { ], ) }; - insta::assert_snapshot!(get_signatures(), @r###" + insta::assert_snapshot!(get_signatures(), @r" @ Test User test.user@example.com 2001-02-03 04:05:07.000 +07:00 │ Test User test.user@example.com 2001-02-03 04:05:07.000 +07:00 ~ - "###); + "); // Reset the author (the committer is always reset) test_env.jj_cmd_ok( @@ -433,11 +431,11 @@ fn test_commit_reset_author() { "-m1", ], ); - insta::assert_snapshot!(get_signatures(), @r###" + insta::assert_snapshot!(get_signatures(), @r" @ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:09.000 +07:00 │ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:09.000 +07:00 ~ - "###); + "); } fn get_log_output(test_env: &TestEnvironment, cwd: &Path) -> String { diff --git a/cli/tests/test_commit_template.rs b/cli/tests/test_commit_template.rs index d450d12db0..f75fd66bb8 100644 --- a/cli/tests/test_commit_template.rs +++ b/cli/tests/test_commit_template.rs @@ -30,7 +30,7 @@ fn test_log_parents() { let template = r#"commit_id ++ "\nP: " ++ parents.len() ++ " " ++ parents.map(|c| c.commit_id()) ++ "\n""#; let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ c067170d4ca1bc6162b64f7550617ec809647f84 ├─╮ P: 2 4db490c88528133d579540b6900b8098f0c17701 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ○ │ 4db490c88528133d579540b6900b8098f0c17701 @@ -39,7 +39,7 @@ fn test_log_parents() { │ P: 1 0000000000000000000000000000000000000000 ◆ 0000000000000000000000000000000000000000 P: 0 - "###); + "); // List can be filtered let template = @@ -59,11 +59,11 @@ fn test_log_parents() { &repo_path, &["log", "-T", template, "-r@", "--color=always"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 4db4 230d │ ~ - "###); + "); // Commit object isn't printable let stderr = test_env.jj_cmd_failure(&repo_path, &["log", "-T", "parents"]); @@ -101,11 +101,11 @@ fn test_log_author_timestamp() { test_env.jj_cmd_ok(&repo_path, &["new", "-m", "second"]); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 2001-02-03 04:05:09.000 +07:00 ○ 2001-02-03 04:05:08.000 +07:00 ◆ 1970-01-01 00:00:00.000 +00:00 - "###); + "); } #[test] @@ -133,10 +133,10 @@ fn test_log_author_timestamp_utc() { let repo_path = test_env.env_root().join("repo"); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().utc()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 2001-02-02 21:05:07.000 +00:00 ◆ 1970-01-01 00:00:00.000 +00:00 - "###); + "); } #[cfg(unix)] @@ -148,16 +148,16 @@ fn test_log_author_timestamp_local() { test_env.add_env_var("TZ", "UTC-05:30"); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().local()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 2001-02-03 08:05:07.000 +11:00 ◆ 1970-01-01 11:00:00.000 +11:00 - "###); + "); test_env.add_env_var("TZ", "UTC+10:00"); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "author.timestamp().local()"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 2001-02-03 08:05:07.000 +11:00 ◆ 1970-01-01 11:00:00.000 +11:00 - "###); + "); } #[test] @@ -177,10 +177,10 @@ fn test_log_author_timestamp_after_before() { if(author.timestamp().before("now"), "(before now)", "(after now)") ) ++ "\n""#; let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-T", template]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" 2001-02-03 04:05:08.000 +07:00 : (after 1969) (after 1975) (before now) 1970-01-01 00:00:00.000 +00:00 : (after 1969) (before 1975) (before now) - "#); + "); // Should display error with invalid date. let template = r#"author.timestamp().after("invalid date")"#; @@ -220,11 +220,11 @@ fn test_mine_is_true_when_author_is_user() { r#"coalesce(if(mine, "mine"), author.email(), email_placeholder)"#, ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ johndoe@example.com ○ mine ◆ (no email set) - "###); + "); } #[test] @@ -240,33 +240,33 @@ fn test_log_default() { // Test default log output format let stdout = test_env.jj_cmd_success(&repo_path, &["log"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e │ (empty) description 1 ○ qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7 │ add a file ◆ zzzzzzzz root() 00000000 - "###); + "); // Color let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e │ (empty) description 1 ○ qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7 │ add a file ◆ zzzzzzzz root() 00000000 - "#); + "); // Color without graph let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always", "--no-graph"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" kkmpptxz test.user@example.com 2001-02-03 08:05:09 my-bookmark bac9ff9e (empty) description 1 qpvuntsm test.user@example.com 2001-02-03 08:05:08 aa2015d7 add a file zzzzzzzz root() 00000000 - "#); + "); } #[test] @@ -277,9 +277,7 @@ fn test_log_default_without_working_copy() { test_env.jj_cmd_ok(&repo_path, &["workspace", "forget"]); let stdout = test_env.jj_cmd_success(&repo_path, &["log"]); - insta::assert_snapshot!(stdout, @r#" - ◆ zzzzzzzz root() 00000000 - "#); + insta::assert_snapshot!(stdout, @"◆ zzzzzzzz root() 00000000"); } #[test] @@ -298,23 +296,23 @@ fn test_log_builtin_templates() { ); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "my-bookmark"]); - insta::assert_snapshot!(render(r#"builtin_log_oneline"#), @r###" + insta::assert_snapshot!(render(r#"builtin_log_oneline"#), @r" rlvkpnrz (no email set) 2001-02-03 08:05:08 my-bookmark dc315397 (empty) (no description set) qpvuntsm test.user 2001-02-03 08:05:07 230dd059 (empty) (no description set) zzzzzzzz root() 00000000 [EOF] - "###); + "); - insta::assert_snapshot!(render(r#"builtin_log_compact"#), @r###" + insta::assert_snapshot!(render(r#"builtin_log_compact"#), @r" rlvkpnrz (no email set) 2001-02-03 08:05:08 my-bookmark dc315397 (empty) (no description set) qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059 (empty) (no description set) zzzzzzzz root() 00000000 [EOF] - "###); + "); - insta::assert_snapshot!(render(r#"builtin_log_comfortable"#), @r###" + insta::assert_snapshot!(render(r#"builtin_log_comfortable"#), @r" rlvkpnrz (no email set) 2001-02-03 08:05:08 my-bookmark dc315397 (empty) (no description set) @@ -324,9 +322,9 @@ fn test_log_builtin_templates() { zzzzzzzz root() 00000000 [EOF] - "###); + "); - insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r" Commit ID: dc31539712c7294d1d712cec63cef4504b94ca74 Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Bookmarks: my-bookmark @@ -350,7 +348,7 @@ fn test_log_builtin_templates() { (no description set) [EOF] - "#); + "); } #[test] @@ -367,21 +365,21 @@ fn test_log_builtin_templates_colored() { ); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "my-bookmark"]); - insta::assert_snapshot!(render(r#"builtin_log_oneline"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_oneline"#), @r" @ rlvkpnrz (no email set) 2001-02-03 08:05:08 my-bookmark dc315397 (empty) (no description set) ○ qpvuntsm test.user 2001-02-03 08:05:07 230dd059 (empty) (no description set) ◆ zzzzzzzz root() 00000000 - "#); + "); - insta::assert_snapshot!(render(r#"builtin_log_compact"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_compact"#), @r" @ rlvkpnrz (no email set) 2001-02-03 08:05:08 my-bookmark dc315397 │ (empty) (no description set) ○ qpvuntsm test.user@example.com 2001-02-03 08:05:07 230dd059 │ (empty) (no description set) ◆ zzzzzzzz root() 00000000 - "#); + "); - insta::assert_snapshot!(render(r#"builtin_log_comfortable"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_comfortable"#), @r" @ rlvkpnrz (no email set) 2001-02-03 08:05:08 my-bookmark dc315397 │ (empty) (no description set) │ @@ -389,10 +387,9 @@ fn test_log_builtin_templates_colored() { │ (empty) (no description set) │ ◆ zzzzzzzz root() 00000000 + "); - "#); - - insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r" @ Commit ID: dc31539712c7294d1d712cec63cef4504b94ca74 │ Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp │ Bookmarks: my-bookmark @@ -414,7 +411,7 @@ fn test_log_builtin_templates_colored() { Committer: (no name set) <(no email set)> (1970-01-01 11:00:00)  (no description set) - "#); + "); } #[test] @@ -431,21 +428,21 @@ fn test_log_builtin_templates_colored_debug() { ); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "my-bookmark"]); - insta::assert_snapshot!(render(r#"builtin_log_oneline"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_oneline"#), @r" <> <><><><><><><><><><><><><><><><> <> <><><><><><><><><><><><><><> <> <><><><><><><><> - "#); + "); - insta::assert_snapshot!(render(r#"builtin_log_compact"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_compact"#), @r" <> <><><><><><><><><><><><> │ <><><><> <> <><><><><><><><><><><><> │ <><><><> <> <><><><><><><><> - "#); + "); - insta::assert_snapshot!(render(r#"builtin_log_comfortable"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_comfortable"#), @r" <> <><><><><><><><><><><><> │ <><><><> │ <> @@ -454,9 +451,9 @@ fn test_log_builtin_templates_colored_debug() { │ <> <> <><><><><><><><> <> - "#); + "); - insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r#" + insta::assert_snapshot!(render(r#"builtin_log_detailed"#), @r" <> <><><> │ <><><> │ <><><> @@ -479,7 +476,7 @@ fn test_log_builtin_templates_colored_debug() { <> <><> <> - "#); + "); } #[test] @@ -492,11 +489,11 @@ fn test_log_evolog_divergence() { test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description 1"]); let stdout = test_env.jj_cmd_success(&repo_path, &["log"]); // No divergence - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ qpvuntsm test.user@example.com 2001-02-03 08:05:08 ff309c29 │ description 1 ◆ zzzzzzzz root() 00000000 - "###); + "); // Create divergence test_env.jj_cmd_ok( @@ -504,48 +501,46 @@ fn test_log_evolog_divergence() { &["describe", "-m", "description 2", "--at-operation", "@-"], ); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 │ description 1 │ ○ qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00 ├─╯ description 2 ◆ zzzzzzzz root() 00000000 - "#); - insta::assert_snapshot!(stderr, @r###" - Concurrent modification detected, resolving automatically. - "###); + "); + insta::assert_snapshot!(stderr, @"Concurrent modification detected, resolving automatically."); // Color let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 │ description 1 │ ○ qpvuntsm?? test.user@example.com 2001-02-03 08:05:10 6ba70e00 ├─╯ description 2 ◆ zzzzzzzz root() 00000000 - "#); + "); // Evolog and hidden divergent let stdout = test_env.jj_cmd_success(&repo_path, &["evolog"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 │ description 1 ○ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 485d52a9 │ (no description set) ○ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 (empty) (no description set) - "###); + "); // Colored evolog let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--color=always"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ qpvuntsm?? test.user@example.com 2001-02-03 08:05:08 ff309c29 │ description 1 ○ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:08 485d52a9 │ (no description set) ○ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 (empty) (no description set) - "###); + "); } #[test] @@ -600,7 +595,7 @@ fn test_log_bookmarks() { let template = r#"commit_id.short() ++ " " ++ if(bookmarks, bookmarks, "(no bookmarks)")"#; let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); - insta::assert_snapshot!(output, @r#" + insta::assert_snapshot!(output, @r" @ a5b4d15489cc bookmark2* new-bookmark ○ 8476341eb395 bookmark2@origin unchanged │ ○ fed794e2ba44 bookmark3?? bookmark3@origin @@ -610,11 +605,11 @@ fn test_log_bookmarks() { │ ○ 4a7e4246fc4d bookmark1* ├─╯ ◆ 000000000000 (no bookmarks) - "#); + "); let template = r#"bookmarks.map(|b| separate("/", b.remote(), b.name())).join(", ")"#; let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); - insta::assert_snapshot!(output, @r#" + insta::assert_snapshot!(output, @r" @ bookmark2, new-bookmark ○ origin/bookmark2, unchanged │ ○ bookmark3, origin/bookmark3 @@ -624,11 +619,11 @@ fn test_log_bookmarks() { │ ○ bookmark1 ├─╯ ◆ - "#); + "); let template = r#"separate(" ", "L:", local_bookmarks, "R:", remote_bookmarks)"#; let output = test_env.jj_cmd_success(&workspace_root, &["log", "-T", template]); - insta::assert_snapshot!(output, @r#" + insta::assert_snapshot!(output, @r" @ L: bookmark2* new-bookmark R: ○ L: unchanged R: bookmark2@origin unchanged@origin │ ○ L: bookmark3?? R: bookmark3@origin @@ -638,7 +633,7 @@ fn test_log_bookmarks() { │ ○ L: bookmark1* R: ├─╯ ◆ L: R: - "#); + "); let template = r#" remote_bookmarks.map(|ref| concat( @@ -652,14 +647,14 @@ fn test_log_bookmarks() { &workspace_root, &["log", "-r::remote_bookmarks()", "-T", template], ); - insta::assert_snapshot!(output, @r###" + insta::assert_snapshot!(output, @r" ○ bookmark3@origin(+0/-1) │ ○ bookmark2@origin(+0/-1) unchanged@origin(+0/-0) ├─╯ │ ○ bookmark1@origin(+1/-1) ├─╯ ◆ - "###); + "); } #[test] @@ -673,20 +668,20 @@ fn test_log_git_head() { std::fs::write(repo_path.join("file"), "foo\n").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "git_head"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ false ○ true ◆ false - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--color=always"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 50aaf475 │ initial ○ qpvuntsm test.user@example.com 2001-02-03 08:05:07 git_head() 230dd059 │ (empty) (no description set) ◆ zzzzzzzz root() 00000000 - "#); + "); } #[test] @@ -706,12 +701,12 @@ fn test_log_commit_id_normal_hex() { r#"commit_id ++ ": " ++ commit_id.normal_hex()"#, ], ); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ 6572f22267c6f0f2bf7b8a37969ee5a7d54b8aae: 6572f22267c6f0f2bf7b8a37969ee5a7d54b8aae ○ 222fa9f0b41347630a1371203b8aad3897d34e5f: 222fa9f0b41347630a1371203b8aad3897d34e5f ○ 230dd059e1b059aefc0da06a2e5a7dbf22362f22: 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000: 0000000000000000000000000000000000000000 - "#); + "); } #[test] @@ -731,12 +726,12 @@ fn test_log_change_id_normal_hex() { r#"change_id ++ ": " ++ change_id.normal_hex()"#, ], ); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ kkmpptxzrspxrzommnulwmwkkqwworpl: ffdaa62087a280bddc5e3d3ff933b8ae ○ rlvkpnrzqnoowoytxnquwvuryrwnrmlp: 8e4fac809cbb3b162c953458183c8dea ○ qpvuntsmwlqtpsluzzsnyyzlmlwvmlnu: 9a45c67d3e96a7e5007c110ede34dec5 ◆ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz: 00000000000000000000000000000000 - "#); + "); } #[test] @@ -757,11 +752,11 @@ fn test_log_customize_short_id() { &format!(r#"{decl}='id.shortest(5).prefix().upper() ++ "_" ++ id.shortest(5).rest()'"#), ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ Q_pvun test.user@example.com 2001-02-03 08:05:08 F_a156 │ (empty) first ◆ Z_zzzz root() 0_0000 - "###); + "); // Customize only the change id let stdout = test_env.jj_cmd_success( @@ -771,11 +766,11 @@ fn test_log_customize_short_id() { "--config=template-aliases.'format_short_change_id(id)'='format_short_id(id).upper()'", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ QPVUNTSM test.user@example.com 2001-02-03 08:05:08 fa15625b │ (empty) first ◆ ZZZZZZZZ root() 00000000 - "###); + "); } #[test] @@ -799,14 +794,14 @@ fn test_log_immutable() { test_env.add_config("revset-aliases.'immutable_heads()' = 'main'"); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r::", "-T", template]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ D │ ○ C │ ◆ B main [immutable] │ ◆ A [immutable] ├─╯ ◆ [immutable] - "###); + "); // Suppress error that could be detected earlier test_env.add_config("revsets.short-prefixes = ''"); @@ -871,14 +866,14 @@ fn test_log_contained_in() { &template_for_revset(r#"description(A)::"#), ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ D │ ○ C [contained_in] │ ○ B main [contained_in] │ ○ A [contained_in] ├─╯ ◆ - "###); + "); let stdout = test_env.jj_cmd_success( &repo_path, @@ -889,14 +884,14 @@ fn test_log_contained_in() { &template_for_revset(r#"visible_heads()"#), ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ D [contained_in] │ ○ C [contained_in] │ ○ B main │ ○ A ├─╯ ◆ - "###); + "); // Suppress error that could be detected earlier let stderr = test_env.jj_cmd_failure( @@ -1000,13 +995,11 @@ fn test_short_prefix_in_transaction() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["new", parent_id, "--no-edit", "-m", "test"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Created new commit km[kuslswpqwq] 7[4ac55dd119b] test - "###); + insta::assert_snapshot!(stderr, @"Created new commit km[kuslswpqwq] 7[4ac55dd119b] test"); // Should match log's short prefixes let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" km[kuslswpqwq] 7[4ac55dd119b] test y[qosqzytrlsw] 5[8731db5875e] commit4 r[oyxmykxtrkr] 9[95cc897bca7] commit3 @@ -1015,12 +1008,12 @@ fn test_short_prefix_in_transaction() { kk[mpptxzrspx] 05[2755155952] commit0 q[pvuntsmwlqt] e[0e22b9fae75] initial zz[zzzzzzzzzz] 00[0000000000] - "###); + "); test_env.add_config(r#"revsets.short-prefixes = """#); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" kmk[uslswpqwq] 74ac[55dd119b] test yq[osqzytrlsw] 587[31db5875e] commit4 ro[yxmykxtrkr] 99[5cc897bca7] commit3 @@ -1029,7 +1022,7 @@ fn test_short_prefix_in_transaction() { kk[mpptxzrspx] 052[755155952] commit0 qp[vuntsmwlqt] e0[e22b9fae75] initial zz[zzzzzzzzzz] 00[0000000000] - "###); + "); } #[test] @@ -1068,7 +1061,7 @@ fn test_log_diff_predefined_formats() { &repo_path, &["log", "--no-graph", "--color=always", "-r@", "-T", template], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" === color_words === Modified regular file file1:  1  1: a @@ -1107,14 +1100,14 @@ fn test_log_diff_predefined_formats() { M file1 M file2 R {rename-source => rename-target} - "###); + "); // color labels let stdout = test_env.jj_cmd_success( &repo_path, &["log", "--no-graph", "--color=debug", "-r@", "-T", template], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" <> <> <><><><> @@ -1153,14 +1146,14 @@ fn test_log_diff_predefined_formats() { <> <> < rename-target}>> - "###); + "); // cwd != workspace root let stdout = test_env.jj_cmd_success( test_env.env_root(), &["log", "-Rrepo", "--no-graph", "-r@", "-T", template], ); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" === color_words === Modified regular file repo/file1: 1 1: a @@ -1199,7 +1192,7 @@ fn test_log_diff_predefined_formats() { M repo/file1 M repo/file2 R repo/{rename-source => rename-target} - "###); + "); // with non-default config std::fs::write( @@ -1294,16 +1287,16 @@ fn test_log_diff_predefined_formats() { // color_words() with parameters let template = "self.diff('file1').color_words(0)"; let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-T", template]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1: ... 3: c - "###); + "); // git() with parameters let template = "self.diff('file1').git(1)"; let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-T", template]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file1 b/file1 index 422c2b7ab3..de980441c3 100644 --- a/file1 @@ -1311,7 +1304,7 @@ fn test_log_diff_predefined_formats() { @@ -2,1 +2,2 @@ b +c - "###); + "); // custom template with files() let template = indoc! {r#" @@ -1472,13 +1465,13 @@ fn test_signature_templates() { // show that signatures can render let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ good test-display signature ○ no signature ◆ no signature - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["show", "-T", template]); - insta::assert_snapshot!(stdout, @r#"good test-display signature"#); + insta::assert_snapshot!(stdout, @"good test-display signature"); // builtin templates test_env.add_config("ui.show-cryptographic-signatures = true"); @@ -1486,24 +1479,24 @@ fn test_signature_templates() { let args: &[_] = &["log", "-r", "..", "-T"]; let stdout = test_env.jj_cmd_success(&repo_path, &[args, &["builtin_log_oneline"]].concat()); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ rlvkpnrz test.user 2001-02-03 08:05:09 a0909ee9 [✓︎] (empty) signed ○ qpvuntsm test.user 2001-02-03 08:05:08 879d5d20 (empty) unsigned │ ~ - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &[args, &["builtin_log_compact"]].concat()); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 a0909ee9 [✓︎] │ (empty) signed ○ qpvuntsm test.user@example.com 2001-02-03 08:05:08 879d5d20 │ (empty) unsigned ~ - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &[args, &["builtin_log_detailed"]].concat()); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ Commit ID: a0909ee96bb5c66311a0c579dc8ebed4456dfc1b │ Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp │ Author : Test User (2001-02-03 08:05:09) @@ -1519,7 +1512,7 @@ fn test_signature_templates() { Signature: (no signature) unsigned - "#); + "); // customization point let config_val = r#"template-aliases."format_short_cryptographic_signature(signature)"="'status: ' ++ signature.status()""#; @@ -1527,10 +1520,10 @@ fn test_signature_templates() { &repo_path, &[args, &["builtin_log_oneline", "--config", config_val]].concat(), ); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ rlvkpnrz test.user 2001-02-03 08:05:09 a0909ee9 status: good (empty) signed ○ qpvuntsm test.user 2001-02-03 08:05:08 879d5d20 status: (empty) unsigned │ ~ - "#); + "); } diff --git a/cli/tests/test_completion.rs b/cli/tests/test_completion.rs index 3357182029..a1c3ef9b44 100644 --- a/cli/tests/test_completion.rs +++ b/cli/tests/test_completion.rs @@ -263,37 +263,37 @@ fn test_remote_names() { test_env.env_root(), &["--", "jj", "git", "remote", "remove", "o"], ); - insta::assert_snapshot!(stdout, @r"origin"); + insta::assert_snapshot!(stdout, @"origin"); let stdout = test_env.jj_cmd_success( test_env.env_root(), &["--", "jj", "git", "remote", "rename", "o"], ); - insta::assert_snapshot!(stdout, @r"origin"); + insta::assert_snapshot!(stdout, @"origin"); let stdout = test_env.jj_cmd_success( test_env.env_root(), &["--", "jj", "git", "remote", "set-url", "o"], ); - insta::assert_snapshot!(stdout, @r"origin"); + insta::assert_snapshot!(stdout, @"origin"); let stdout = test_env.jj_cmd_success( test_env.env_root(), &["--", "jj", "git", "push", "--remote", "o"], ); - insta::assert_snapshot!(stdout, @r"origin"); + insta::assert_snapshot!(stdout, @"origin"); let stdout = test_env.jj_cmd_success( test_env.env_root(), &["--", "jj", "git", "fetch", "--remote", "o"], ); - insta::assert_snapshot!(stdout, @r"origin"); + insta::assert_snapshot!(stdout, @"origin"); let stdout = test_env.jj_cmd_success( test_env.env_root(), &["--", "jj", "bookmark", "list", "--remote", "o"], ); - insta::assert_snapshot!(stdout, @r"origin"); + insta::assert_snapshot!(stdout, @"origin"); } #[test] @@ -717,7 +717,7 @@ fn test_files() { ); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-r", "all()", "--summary"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" @ wqnwkozp test.user@example.com 2001-02-03 08:05:20 working_copy 45c3a621 │ working_copy │ A f_added_2 @@ -753,7 +753,7 @@ fn test_files() { │ A f_interdiff_only_from │ A f_interdiff_same ◆ zzzzzzzz root() 00000000 - "###); + "); let mut test_env = test_env; test_env.add_env_var("COMPLETE", "fish"); @@ -887,5 +887,5 @@ fn test_files() { let outside_repo = test_env.env_root(); let stdout = test_env.jj_cmd_success(outside_repo, &["--", "jj", "log", "f_"]); - insta::assert_snapshot!(stdout, @r""); + insta::assert_snapshot!(stdout, @""); } diff --git a/cli/tests/test_concurrent_operations.rs b/cli/tests/test_concurrent_operations.rs index d64427d21e..f68328e319 100644 --- a/cli/tests/test_concurrent_operations.rs +++ b/cli/tests/test_concurrent_operations.rs @@ -39,26 +39,24 @@ fn test_concurrent_operation_divergence() { // "op log --at-op" should work without merging the head operations let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "--at-op=d74dff64472e"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ d74dff64472e test-username@host.example.com 2001-02-03 04:05:09.000 +07:00 - 2001-02-03 04:05:09.000 +07:00 │ describe commit 230dd059e1b059aefc0da06a2e5a7dbf22362f22 │ args: jj describe -m 'message 2' --at-op @- ○ eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' ○ 000000000000 root() - "#); + "); // We should be informed about the concurrent modification let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "-T", "description"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ message 1 │ ○ message 2 ├─╯ ◆ - "#); - insta::assert_snapshot!(stderr, @r###" - Concurrent modification detected, resolving automatically. - "###); + "); + insta::assert_snapshot!(stderr, @"Concurrent modification detected, resolving automatically."); } #[test] @@ -70,7 +68,7 @@ fn test_concurrent_operations_auto_rebase() { std::fs::write(repo_path.join("file"), "contents").unwrap(); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "initial"]); let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ c62ace5c0522 test-username@host.example.com 2001-02-03 04:05:08.000 +07:00 - 2001-02-03 04:05:08.000 +07:00 │ describe commit 4e8f9d2be039994f589b4e57ac5e9488703e604d │ args: jj describe -m initial @@ -80,7 +78,7 @@ fn test_concurrent_operations_auto_rebase() { ○ eac759b9ab75 test-username@host.example.com 2001-02-03 04:05:07.000 +07:00 - 2001-02-03 04:05:07.000 +07:00 │ add workspace 'default' ○ 000000000000 root() - "#); + "); let op_id_hex = stdout[3..15].to_string(); test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "rewritten"]); @@ -91,15 +89,15 @@ fn test_concurrent_operations_auto_rebase() { // We should be informed about the concurrent modification let (stdout, stderr) = get_log_output_with_stderr(&test_env, &repo_path); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ○ db141860e12c2d5591c56fde4fc99caf71cec418 new child @ 07c3641e495cce57ea4ca789123b52f421c57aa2 rewritten ◆ 0000000000000000000000000000000000000000 - "###); - insta::assert_snapshot!(stderr, @r###" + "); + insta::assert_snapshot!(stderr, @r" Concurrent modification detected, resolving automatically. Rebased 1 descendant commits onto commits rewritten by other operation - "###); + "); } #[test] @@ -125,18 +123,16 @@ fn test_concurrent_operations_wc_modified() { // We should be informed about the concurrent modification let (stdout, stderr) = get_log_output_with_stderr(&test_env, &repo_path); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 4eadcf3df11f46ef3d825c776496221cc8303053 new child1 │ ○ 68119f1643b7e3c301c5f7c2b6c9bf4ccba87379 new child2 ├─╯ ○ 2ff7ae858a3a11837fdf9d1a76be295ef53f1bb3 initial ◆ 0000000000000000000000000000000000000000 - "###); - insta::assert_snapshot!(stderr, @r###" - Concurrent modification detected, resolving automatically. - "###); + "); + insta::assert_snapshot!(stderr, @"Concurrent modification detected, resolving automatically."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file b/file index 12f00e90b6..2e0996000b 100644 --- a/file @@ -144,11 +140,11 @@ fn test_concurrent_operations_wc_modified() { @@ -1,1 +1,1 @@ -contents +modified - "###); + "); // The working copy should be committed after merging the operations let stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-Tdescription"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ snapshot working copy ○ reconcile divergent operations ├─╮ @@ -159,7 +155,7 @@ fn test_concurrent_operations_wc_modified() { ○ snapshot working copy ○ add workspace 'default' ○ - "#); + "); } #[test] @@ -182,7 +178,7 @@ fn test_concurrent_snapshot_wc_reloadable() { let template = r#"id ++ "\n" ++ description ++ "\n" ++ tags"#; let op_log_stdout = test_env.jj_cmd_success(&repo_path, &["op", "log", "-T", template]); - insta::assert_snapshot!(op_log_stdout, @r#" + insta::assert_snapshot!(op_log_stdout, @r" @ ec6bf266624bbaed55833a34ae62fa95c0e9efa651b94eb28846972da645845052dcdc8580332a5628849f23f48b9e99fc728dc3fb13106df8d0666d746f8b85 │ commit 554d22b2c43c1c47e279430197363e8daabe2fd6 │ args: jj commit -m 'new child1' @@ -198,8 +194,7 @@ fn test_concurrent_snapshot_wc_reloadable() { ○ eac759b9ab75793fd3da96e60939fb48f2cd2b2a9c1f13ffe723cf620f3005b8d3e7e923634a07ea39513e4f2f360c87b9ad5d331cf90d7a844864b83b72eba1 │ add workspace 'default' ○ 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - - "#); + "); let op_log_lines = op_log_stdout.lines().collect_vec(); let current_op_id = op_log_lines[0].split_once(" ").unwrap().1; let previous_op_id = op_log_lines[6].split_once(" ").unwrap().1; @@ -214,16 +209,16 @@ fn test_concurrent_snapshot_wc_reloadable() { std::fs::write(repo_path.join("child2"), "").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "new child2"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: kkmpptxz 1795621b new child2 Parent commit : rlvkpnrz 86f54245 new child1 - "###); + "); // Since the repo can be reloaded before snapshotting, "child2" should be // a child of "child1", not of "initial". let template = r#"commit_id ++ " " ++ description"#; let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", template, "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 1795621b54f4ebb435978b65d66bc0f90d8f20b6 new child2 │ A child2 ○ 86f54245e13f850f8275b5541e56da996b6a47b7 new child1 @@ -231,7 +226,7 @@ fn test_concurrent_snapshot_wc_reloadable() { ○ 84f07f6bca2ffeddac84a8b09f60c6b81112375c initial │ A base ◆ 0000000000000000000000000000000000000000 - "###); + "); } fn get_log_output_with_stderr(test_env: &TestEnvironment, cwd: &Path) -> (String, String) { diff --git a/cli/tests/test_config_command.rs b/cli/tests/test_config_command.rs index d3713898dc..3489052da2 100644 --- a/cli/tests/test_config_command.rs +++ b/cli/tests/test_config_command.rs @@ -36,17 +36,13 @@ fn test_config_list_single() { test_env.env_root(), &["config", "list", "test-table.somekey"], ); - insta::assert_snapshot!(stdout, @r###" - test-table.somekey = "some value" - "###); + insta::assert_snapshot!(stdout, @r#"test-table.somekey = "some value""#); let stdout = test_env.jj_cmd_success( test_env.env_root(), &["config", "list", r#"-Tname ++ "\n""#, "test-table.somekey"], ); - insta::assert_snapshot!(stdout, @r###" - test-table.somekey - "###); + insta::assert_snapshot!(stdout, @"test-table.somekey"); } #[test] @@ -57,9 +53,7 @@ fn test_config_list_nonexistent() { &["config", "list", "nonexistent-test-key"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Warning: No matching config key for nonexistent-test-key - "###); + insta::assert_snapshot!(stderr, @"Warning: No matching config key for nonexistent-test-key"); } #[test] @@ -77,12 +71,12 @@ fn test_config_list_table() { let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-table"]); insta::assert_snapshot!( stdout, - @r###" + @r#" test-table.x = true test-table.y.foo = "abc" test-table.y.bar = 123 test-table.z."with space"."function()" = 5 - "###); + "#); } #[test] @@ -113,9 +107,7 @@ fn test_config_list_array() { "#, ); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-array"]); - insta::assert_snapshot!(stdout, @r###" - test-array = [1, "b", 3.4] - "###); + insta::assert_snapshot!(stdout, @r#"test-array = [1, "b", 3.4]"#); } #[test] @@ -132,9 +124,7 @@ fn test_config_list_array_of_tables() { ); // Array is a value, so is array of tables let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "test-table"]); - insta::assert_snapshot!(stdout, @r###" - test-table = [{ x = 1 }, { y = ["z"], z = { "key=with whitespace" = [] } }] - "###); + insta::assert_snapshot!(stdout, @r#"test-table = [{ x = 1 }, { y = ["z"], z = { "key=with whitespace" = [] } }]"#); } #[test] @@ -153,12 +143,12 @@ fn test_config_list_all() { let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list"]); insta::assert_snapshot!( find_stdout_lines(r"(test-val|test-table\b[^=]*)", &stdout), - @r###" + @r#" test-val = [1, 2, 3] test-table.x = true test-table.y.foo = "abc" test-table.y.bar = 123 - "###); + "#); } #[test] @@ -227,10 +217,10 @@ fn test_config_list_layer() { ); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--user"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r#" test-key = "test-val" test-layered-key = "test-original-val" - "###); + "#); // Repo test_env.jj_cmd_ok( @@ -245,14 +235,10 @@ fn test_config_list_layer() { ); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--user"]); - insta::assert_snapshot!(stdout, @r###" - test-key = "test-val" - "###); + insta::assert_snapshot!(stdout, @r#"test-key = "test-val""#); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", "--repo"]); - insta::assert_snapshot!(stdout, @r###" - test-layered-key = "test-layered-val" - "###); + insta::assert_snapshot!(stdout, @r#"test-layered-key = "test-layered-val""#); } #[test] @@ -267,9 +253,7 @@ fn test_config_layer_override_default() { &repo_path, &["config", "list", config_key, "--include-defaults"], ); - insta::assert_snapshot!(stdout, @r###" - merge-tools.vimdiff.program = "vim" - "###); + insta::assert_snapshot!(stdout, @r#"merge-tools.vimdiff.program = "vim""#); // User test_env.add_config(format!( @@ -277,9 +261,7 @@ fn test_config_layer_override_default() { value = to_toml_value("user") )); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); - insta::assert_snapshot!(stdout, @r###" - merge-tools.vimdiff.program = "user" - "###); + insta::assert_snapshot!(stdout, @r#"merge-tools.vimdiff.program = "user""#); // Repo std::fs::write( @@ -288,9 +270,7 @@ fn test_config_layer_override_default() { ) .unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); - insta::assert_snapshot!(stdout, @r###" - merge-tools.vimdiff.program = "repo" - "###); + insta::assert_snapshot!(stdout, @r#"merge-tools.vimdiff.program = "repo""#); // Command argument let stdout = test_env.jj_cmd_success( @@ -303,9 +283,7 @@ fn test_config_layer_override_default() { &format!("{config_key}={value}", value = to_toml_value("command-arg")), ], ); - insta::assert_snapshot!(stdout, @r###" - merge-tools.vimdiff.program = "command-arg" - "###); + insta::assert_snapshot!(stdout, @r#"merge-tools.vimdiff.program = "command-arg""#); // Allow printing overridden values let stdout = test_env.jj_cmd_success( @@ -319,11 +297,11 @@ fn test_config_layer_override_default() { &format!("{config_key}={value}", value = to_toml_value("command-arg")), ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r##" # merge-tools.vimdiff.program = "user" # merge-tools.vimdiff.program = "repo" merge-tools.vimdiff.program = "command-arg" - "###); + "##); let stdout = test_env.jj_cmd_success( &repo_path, @@ -335,10 +313,10 @@ fn test_config_layer_override_default() { "--include-overridden", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r#" # merge-tools.vimdiff.program = "user" merge-tools.vimdiff.program = "repo" - "###); + "#); } #[test] @@ -351,9 +329,7 @@ fn test_config_layer_override_env() { // Environment base test_env.add_env_var("EDITOR", "env-base"); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); - insta::assert_snapshot!(stdout, @r###" - ui.editor = "env-base" - "###); + insta::assert_snapshot!(stdout, @r#"ui.editor = "env-base""#); // User test_env.add_config(format!( @@ -361,9 +337,7 @@ fn test_config_layer_override_env() { value = to_toml_value("user") )); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); - insta::assert_snapshot!(stdout, @r###" - ui.editor = "user" - "###); + insta::assert_snapshot!(stdout, @r#"ui.editor = "user""#); // Repo std::fs::write( @@ -372,16 +346,12 @@ fn test_config_layer_override_env() { ) .unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); - insta::assert_snapshot!(stdout, @r###" - ui.editor = "repo" - "###); + insta::assert_snapshot!(stdout, @r#"ui.editor = "repo""#); // Environment override test_env.add_env_var("JJ_EDITOR", "env-override"); let stdout = test_env.jj_cmd_success(&repo_path, &["config", "list", config_key]); - insta::assert_snapshot!(stdout, @r###" - ui.editor = "env-override" - "###); + insta::assert_snapshot!(stdout, @r#"ui.editor = "env-override""#); // Command argument let stdout = test_env.jj_cmd_success( @@ -394,9 +364,7 @@ fn test_config_layer_override_env() { &format!("{config_key}={value}", value = to_toml_value("command-arg")), ], ); - insta::assert_snapshot!(stdout, @r###" - ui.editor = "command-arg" - "###); + insta::assert_snapshot!(stdout, @r#"ui.editor = "command-arg""#); // Allow printing overridden values let stdout = test_env.jj_cmd_success( @@ -410,13 +378,13 @@ fn test_config_layer_override_env() { &format!("{config_key}={value}", value = to_toml_value("command-arg")), ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r##" # ui.editor = "env-base" # ui.editor = "user" # ui.editor = "repo" # ui.editor = "env-override" ui.editor = "command-arg" - "###); + "##); } #[test] @@ -444,20 +412,16 @@ fn test_config_layer_workspace() { ) .unwrap(); let stdout = test_env.jj_cmd_success(&main_path, &["config", "list", config_key]); - insta::assert_snapshot!(stdout, @r###" - ui.editor = "main-repo" - "###); + insta::assert_snapshot!(stdout, @r#"ui.editor = "main-repo""#); let stdout = test_env.jj_cmd_success(&secondary_path, &["config", "list", config_key]); - insta::assert_snapshot!(stdout, @r###" - ui.editor = "main-repo" - "###); + insta::assert_snapshot!(stdout, @r#"ui.editor = "main-repo""#); } #[test] fn test_config_set_bad_opts() { let test_env = TestEnvironment::default(); let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["config", "set"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: the following required arguments were not provided: <--user|--repo> @@ -466,11 +430,11 @@ fn test_config_set_bad_opts() { Usage: jj config set <--user|--repo> For more information, try '--help'. - "###); + "); let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["config", "set", "--user", "", "x"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: invalid value '' for '': TOML parse error at line 1, column 1 | 1 | @@ -479,7 +443,7 @@ fn test_config_set_bad_opts() { For more information, try '--help'. - "###); + "); let stderr = test_env.jj_cmd_cli_error( test_env.env_root(), @@ -584,12 +548,12 @@ fn test_config_set_for_repo() { expected_repo_config_path.display() ) }); - insta::assert_snapshot!(repo_config_toml, @r###" + insta::assert_snapshot!(repo_config_toml, @r#" test-key = "test-val" [test-table] foo = true - "###); + "#); } #[test] @@ -610,7 +574,7 @@ fn test_config_set_toml_types() { set_value("test-table.boolean", "true"); set_value("test-table.string", r#""foo""#); set_value("test-table.invalid", r"a + b"); - insta::assert_snapshot!(std::fs::read_to_string(&user_config_path).unwrap(), @r###" + insta::assert_snapshot!(std::fs::read_to_string(&user_config_path).unwrap(), @r#" [test-table] integer = 42 float = 3.14 @@ -618,7 +582,7 @@ fn test_config_set_toml_types() { boolean = true string = "foo" invalid = "a + b" - "###); + "#); } #[test] @@ -774,9 +738,7 @@ fn test_config_unset_for_user() { test_env.jj_cmd_ok(&repo_path, &["config", "unset", "--user", "table.inline"]); let user_config_toml = std::fs::read_to_string(&user_config_path).unwrap(); - insta::assert_snapshot!(user_config_toml, @r#" - [table] - "#); + insta::assert_snapshot!(user_config_toml, @"[table]"); } #[test] @@ -800,14 +762,14 @@ fn test_config_unset_for_repo() { fn test_config_edit_missing_opt() { let test_env = TestEnvironment::default(); let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["config", "edit"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: the following required arguments were not provided: <--user|--repo> Usage: jj config edit <--user|--repo> For more information, try '--help'. - "###); + "); } #[test] @@ -928,14 +890,10 @@ fn test_config_get() { "); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "table.string"]); - insta::assert_snapshot!(stdout, @r###" - some value 1 - "###); + insta::assert_snapshot!(stdout, @"some value 1"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "table.int"]); - insta::assert_snapshot!(stdout, @r###" - 123 - "###); + insta::assert_snapshot!(stdout, @"123"); let stdout = test_env.jj_cmd_failure(test_env.env_root(), &["config", "get", "table.list"]); insta::assert_snapshot!(stdout, @r" @@ -973,34 +931,24 @@ fn test_config_path_syntax() { ); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "a.'b()'"]); - insta::assert_snapshot!(stdout, @r###" - a.'b()' = 0 - "###); + insta::assert_snapshot!(stdout, @"a.'b()' = 0"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r#" 'b c'.d = 1 'b c'.e."f[]" = 2 - "###); + "#); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'.d"]); - insta::assert_snapshot!(stdout, @r###" - 'b c'.d = 1 - "###); + insta::assert_snapshot!(stdout, @"'b c'.d = 1"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'b c'.e.'f[]'"]); - insta::assert_snapshot!(stdout, @r###" - 'b c'.e.'f[]' = 2 - "###); + insta::assert_snapshot!(stdout, @"'b c'.e.'f[]' = 2"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "'b c'.e.'f[]'"]); - insta::assert_snapshot!(stdout, @r###" - 2 - "###); + insta::assert_snapshot!(stdout, @"2"); // Not a table let (stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["config", "list", "a.'b()'.x"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Warning: No matching config key for a.'b()'.x - "###); + insta::assert_snapshot!(stderr, @"Warning: No matching config key for a.'b()'.x"); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["config", "get", "a.'b()'.x"]); insta::assert_snapshot!(stderr, @r" Config error: Value not found for a.'b()'.x @@ -1009,25 +957,17 @@ fn test_config_path_syntax() { // "-" and "_" are valid TOML keys let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "-"]); - insta::assert_snapshot!(stdout, @r###" - - = 3 - "###); + insta::assert_snapshot!(stdout, @"- = 3"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "_"]); - insta::assert_snapshot!(stdout, @r###" - _ = 4 - "###); + insta::assert_snapshot!(stdout, @"_ = 4"); // "." requires quoting let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "'.'"]); - insta::assert_snapshot!(stdout, @r###" - '.' = 5 - "###); + insta::assert_snapshot!(stdout, @"'.' = 5"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "get", "'.'"]); - insta::assert_snapshot!(stdout, @r###" - 5 - "###); + insta::assert_snapshot!(stdout, @"5"); let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["config", "get", "."]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: invalid value '.' for '': TOML parse error at line 1, column 1 | 1 | . @@ -1036,11 +976,11 @@ fn test_config_path_syntax() { For more information, try '--help'. - "###); + "); // Invalid TOML keys let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["config", "list", "b c"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: invalid value 'b c' for '[NAME]': TOML parse error at line 1, column 3 | 1 | b c @@ -1049,9 +989,9 @@ fn test_config_path_syntax() { For more information, try '--help'. - "###); + "); let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["config", "list", ""]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: invalid value '' for '[NAME]': TOML parse error at line 1, column 1 | 1 | @@ -1060,7 +1000,7 @@ fn test_config_path_syntax() { For more information, try '--help'. - "###); + "); } #[test] @@ -1113,31 +1053,31 @@ fn test_config_conditional() { let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "get", "qux"]); insta::assert_snapshot!(stdout, @"get"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["config", "list", "--user"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" foo = 'global' baz = 'config' qux = 'list' - "#); + "); let stdout = test_env.jj_cmd_success(&repo1_path, &["config", "list", "--user"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" foo = 'repo1' baz = 'config' qux = 'list' - "#); + "); let stdout = test_env.jj_cmd_success(&repo2_path, &["config", "list", "--user"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" foo = 'repo2' baz = 'config' qux = 'list' - "#); + "); // relative workspace path let stdout = test_env.jj_cmd_success(&repo2_path, &["config", "list", "--user", "-R../repo1"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" foo = 'repo1' baz = 'config' qux = 'list' - "#); + "); // set and unset should refer to the source config // (there's no option to update scoped table right now.) @@ -1256,11 +1196,11 @@ fn test_config_author_change_warning() { &["config", "set", "--repo", "user.email", "'Foo'"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Warning: This setting will only impact future commits. The author of the working copy will stay "Test User ". To change the working copy author, use "jj describe --reset-author --no-edit" - "###); + "#); // test_env.jj_cmd resets state for every invocation // for this test, the state (user.email) is needed diff --git a/cli/tests/test_copy_detection.rs b/cli/tests/test_copy_detection.rs index f728493066..edfb31dd54 100644 --- a/cli/tests/test_copy_detection.rs +++ b/cli/tests/test_copy_detection.rs @@ -28,7 +28,5 @@ fn test_simple_rename() { std::fs::write(repo_path.join("modified"), "original").unwrap(); std::fs::write(repo_path.join("something"), "changed").unwrap(); insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["debug", "copy-detection"]).replace('\\', "/"), - @r###" - original -> modified - "###); + @"original -> modified"); } diff --git a/cli/tests/test_debug_command.rs b/cli/tests/test_debug_command.rs index 5566acbc4c..d67c0e721a 100644 --- a/cli/tests/test_debug_command.rs +++ b/cli/tests/test_debug_command.rs @@ -24,16 +24,16 @@ fn test_debug_fileset() { let workspace_path = test_env.env_root().join("repo"); let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "fileset", "all()"]); - assert_snapshot!(stdout, @r###" + assert_snapshot!(stdout, @r" -- Parsed: All -- Matcher: EverythingMatcher - "###); + "); let stderr = test_env.jj_cmd_failure(&workspace_path, &["debug", "fileset", "cwd:.."]); - assert_snapshot!(stderr.replace('\\', "/"), @r###" + assert_snapshot!(stderr.replace('\\', "/"), @r#" Error: Failed to parse fileset: Invalid file pattern Caused by: 1: --> 1:1 @@ -44,7 +44,7 @@ fn test_debug_fileset() { = Invalid file pattern 2: Path ".." is not in the repo "." 3: Invalid component ".." in repo-relative path "../" - "###); + "#); } #[test] @@ -89,7 +89,7 @@ fn test_debug_index() { test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); let workspace_path = test_env.env_root().join("repo"); let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "index"]); - assert_snapshot!(filter_index_stats(&stdout), @r###" + assert_snapshot!(filter_index_stats(&stdout), @r" Number of commits: 2 Number of merges: 0 Max generation number: 1 @@ -99,7 +99,7 @@ fn test_debug_index() { Level 0: Number of commits: 2 Name: [hash] - "### + " ); } @@ -111,7 +111,7 @@ fn test_debug_reindex() { test_env.jj_cmd_ok(&workspace_path, &["new"]); test_env.jj_cmd_ok(&workspace_path, &["new"]); let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "index"]); - assert_snapshot!(filter_index_stats(&stdout), @r###" + assert_snapshot!(filter_index_stats(&stdout), @r" Number of commits: 4 Number of merges: 0 Max generation number: 3 @@ -124,15 +124,13 @@ fn test_debug_reindex() { Level 1: Number of commits: 1 Name: [hash] - "### + " ); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["debug", "reindex"]); assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Finished indexing 4 commits. - "###); + insta::assert_snapshot!(stderr, @"Finished indexing 4 commits."); let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "index"]); - assert_snapshot!(filter_index_stats(&stdout), @r###" + assert_snapshot!(filter_index_stats(&stdout), @r" Number of commits: 4 Number of merges: 0 Max generation number: 3 @@ -142,7 +140,7 @@ fn test_debug_reindex() { Level 0: Number of commits: 4 Name: [hash] - "### + " ); } @@ -159,24 +157,20 @@ fn test_debug_tree() { // Defaults to showing the tree at the current commit let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "tree"]); - assert_snapshot!(stdout.replace('\\',"/"), @r###" + assert_snapshot!(stdout.replace('\\',"/"), @r#" dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false }))) dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) - "### + "# ); // Can show the tree at another commit let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "tree", "-r@-"]); - assert_snapshot!(stdout.replace('\\',"/"), @r###" - dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false }))) - "### + assert_snapshot!(stdout.replace('\\',"/"), @r#"dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false })))"# ); // Can filter by paths let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "tree", "dir/subdir/file2"]); - assert_snapshot!(stdout.replace('\\',"/"), @r###" - dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) - "### + assert_snapshot!(stdout.replace('\\',"/"), @r#"dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false })))"# ); // Can a show the root tree by id @@ -188,10 +182,10 @@ fn test_debug_tree() { "--id=0958358e3f80e794f032b25ed2be96cf5825da6c", ], ); - assert_snapshot!(stdout.replace('\\',"/"), @r###" + assert_snapshot!(stdout.replace('\\',"/"), @r#" dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false }))) dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) - "### + "# ); // Can a show non-root tree by id @@ -204,10 +198,10 @@ fn test_debug_tree() { "--id=6ac232efa713535ae518a1a898b77e76c0478184", ], ); - assert_snapshot!(stdout.replace('\\',"/"), @r###" + assert_snapshot!(stdout.replace('\\',"/"), @r#" dir/subdir/file1: Ok(Resolved(Some(File { id: FileId("498e9b01d79cb8d31cdf0df1a663cc1fcefd9de3"), executable: false }))) dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) - "### + "# ); // Can filter by paths when showing non-root tree (matcher applies from root) @@ -221,9 +215,7 @@ fn test_debug_tree() { "dir/subdir/file2", ], ); - assert_snapshot!(stdout.replace('\\',"/"), @r###" - dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false }))) - "### + assert_snapshot!(stdout.replace('\\',"/"), @r#"dir/subdir/file2: Ok(Resolved(Some(File { id: FileId("b2496eaffe394cd50a9db4de5787f45f09fd9722"), executable: false })))"# ); } @@ -234,9 +226,7 @@ fn test_debug_operation_id() { let workspace_path = test_env.env_root().join("repo"); let stdout = test_env.jj_cmd_success(&workspace_path, &["debug", "operation", "--display", "id"]); - assert_snapshot!(filter_index_stats(&stdout), @r#" - eac759b9ab75793fd3da96e60939fb48f2cd2b2a9c1f13ffe723cf620f3005b8d3e7e923634a07ea39513e4f2f360c87b9ad5d331cf90d7a844864b83b72eba1 - "# + assert_snapshot!(filter_index_stats(&stdout), @"eac759b9ab75793fd3da96e60939fb48f2cd2b2a9c1f13ffe723cf620f3005b8d3e7e923634a07ea39513e4f2f360c87b9ad5d331cf90d7a844864b83b72eba1" ); } diff --git a/cli/tests/test_describe_command.rs b/cli/tests/test_describe_command.rs index d357a106fb..e0d15ad9c0 100644 --- a/cli/tests/test_describe_command.rs +++ b/cli/tests/test_describe_command.rs @@ -32,42 +32,38 @@ fn test_describe() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description from CLI"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 95979928 (empty) description from CLI Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); // Set the same description using `-m` flag, but with explicit newline let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "description from CLI\n"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); // Check that the text file gets initialized with the current description and // make no changes std::fs::write(&edit_script, "dump editor0").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r#" description from CLI JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); // Set a description in editor std::fs::write(&edit_script, "write\ndescription from editor").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 94fcb906 (empty) description from editor Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); // Lines in editor starting with "JJ: " are ignored std::fs::write( @@ -77,64 +73,60 @@ fn test_describe() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 7a348923 (empty) description among comment Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); // Multi-line description std::fs::write(&edit_script, "write\nline1\nline2\n\nline4\n\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 749361b5 (empty) line1 Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" line1 line2 line4 - "###); + "); // Multi-line description again with CRLF, which should make no changes std::fs::write(&edit_script, "write\nline1\r\nline2\r\n\r\nline4\r\n\r\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); // Multi-line description starting with newlines std::fs::write(&edit_script, "write\n\n\nline1\nline2").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm dc44dbee (empty) line1 Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" line1 line2 - "#); + "); // Clear description let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe", "-m", ""]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 6296963b (empty) (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); std::fs::write(&edit_script, "write\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); // Fails if the editor fails std::fs::write(&edit_script, "fail").unwrap(); @@ -170,17 +162,17 @@ fn test_describe() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 10fa2dc7 (empty) description from editor Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" description from editor content of message from editor - "#); + "); } #[test] @@ -235,12 +227,12 @@ fn test_describe_multiple_commits() { // Initial setup test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ c6349e79bbfd ○ 65b6b74e0897 ○ 230dd059e1b0 ◆ 000000000000 - "###); + "); // Set the description of multiple commits using `-m` flag let (stdout, stderr) = test_env.jj_cmd_ok( @@ -248,18 +240,18 @@ fn test_describe_multiple_commits() { &["describe", "-r@", "-r@--", "-m", "description from CLI"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Updated 2 commits Rebased 1 descendant commits Working copy now at: kkmpptxz 41659b84 (empty) description from CLI Parent commit : rlvkpnrz 8d650510 (empty) (no description set) - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 41659b846096 description from CLI ○ 8d650510daad ○ a42f5755e688 description from CLI ◆ 000000000000 - "###); + "); // Check that the text file gets initialized with the current description of // each commit and doesn't update commits if no changes are made. @@ -267,11 +259,9 @@ fn test_describe_multiple_commits() { std::fs::write(&edit_script, "dump editor0").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe", "-r@", "@-"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor0")).unwrap(), @r#" JJ: Enter or edit commit descriptions after the `JJ: describe` lines. JJ: Warning: JJ: - The text you enter will be lost on a syntax error. @@ -283,7 +273,7 @@ fn test_describe_multiple_commits() { description from CLI JJ: Lines starting with "JJ: " (like this one) will be removed. - "###); + "#); // Set the description of multiple commits in the editor std::fs::write( @@ -310,12 +300,12 @@ fn test_describe_multiple_commits() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe", "@", "@-"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Updated 2 commits Working copy now at: kkmpptxz f203494a (empty) description from editor of @ Parent commit : rlvkpnrz 0d76a92c (empty) description from editor of @- - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ f203494a4507 description from editor of @ │ │ further commit message of @ @@ -324,7 +314,7 @@ fn test_describe_multiple_commits() { │ further commit message of @- ○ a42f5755e688 description from CLI ◆ 000000000000 - "###); + "); // Fails if the edited message has a commit with multiple descriptions std::fs::write( @@ -351,9 +341,7 @@ fn test_describe_multiple_commits() { ) .unwrap(); let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "@", "@-"]); - insta::assert_snapshot!(stderr, @r###" - Error: The following commits were found in the edited message multiple times: 0d76a92ca7cc - "###); + insta::assert_snapshot!(stderr, @"Error: The following commits were found in the edited message multiple times: 0d76a92ca7cc"); // Fails if the edited message has unexpected commit IDs std::fs::write( @@ -378,9 +366,7 @@ fn test_describe_multiple_commits() { ) .unwrap(); let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "@", "@-"]); - insta::assert_snapshot!(stderr, @r###" - Error: The following commits were not being edited, but were found in the edited message: 000000000000 - "###); + insta::assert_snapshot!(stderr, @"Error: The following commits were not being edited, but were found in the edited message: 000000000000"); // Fails if the edited message has missing commit messages std::fs::write( @@ -397,9 +383,7 @@ fn test_describe_multiple_commits() { ) .unwrap(); let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "@", "@-"]); - insta::assert_snapshot!(stderr, @r###" - Error: The description for the following commits were not found in the edited message: 0d76a92ca7cc - "###); + insta::assert_snapshot!(stderr, @"Error: The description for the following commits were not found in the edited message: 0d76a92ca7cc"); // Fails if the edited message has a line which does not have any preceding // `JJ: describe` headers @@ -417,9 +401,7 @@ fn test_describe_multiple_commits() { ) .unwrap(); let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "@", "@-"]); - insta::assert_snapshot!(stderr, @r###" - Error: Found the following line without a commit header: "description from editor of @-" - "###); + insta::assert_snapshot!(stderr, @r#"Error: Found the following line without a commit header: "description from editor of @-""#); // Fails if the editor fails std::fs::write(&edit_script, "fail").unwrap(); @@ -459,20 +441,20 @@ fn test_describe_multiple_commits() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["describe", "@-", "@--"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Updated 2 commits Rebased 1 descendant commits Working copy now at: kkmpptxz 1d7701ee (empty) description from editor of @ Parent commit : rlvkpnrz 5389926e (empty) description from editor for @- - "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 1d7701eec9bc description from editor of @ │ │ further commit message of @ ○ 5389926ebed6 description from editor for @- ○ eaa8547ae37a description from editor for @-- ◆ 000000000000 - "#); + "); } #[test] @@ -493,18 +475,18 @@ fn test_multiple_message_args() { ], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 99a36a50 (empty) First Paragraph from CLI Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" First Paragraph from CLI Second Paragraph from CLI - "###); + "); // Set the same description, with existing newlines let (stdout, stderr) = test_env.jj_cmd_ok( @@ -518,9 +500,7 @@ fn test_multiple_message_args() { ], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); // Use an empty -m flag between paragraphs to insert an extra blank line let (stdout, stderr) = test_env.jj_cmd_ok( @@ -536,19 +516,19 @@ fn test_multiple_message_args() { ], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 01ac40b3 (empty) First Paragraph from CLI Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "--no-graph", "-r@", "-Tdescription"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" First Paragraph from CLI Second Paragraph from CLI - "###); + "); } #[test] @@ -564,12 +544,12 @@ fn test_describe_default_description() { std::fs::write(edit_script, ["dump editor"].join("\0")).unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_path, &["describe"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 573b6df5 TESTED=TODO Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "###); + "); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" TESTED=TODO JJ: This commit contains the following changes: @@ -577,7 +557,7 @@ fn test_describe_default_description() { JJ: A file2 JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); } #[test] @@ -626,7 +606,7 @@ fn test_describe_author() { test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]); - insta::assert_snapshot!(get_signatures(), @r###" + insta::assert_snapshot!(get_signatures(), @r" @ Test User test.user@example.com 2001-02-03 04:05:10.000 +07:00 │ Test User test.user@example.com 2001-02-03 04:05:10.000 +07:00 ○ Test User test.user@example.com 2001-02-03 04:05:09.000 +07:00 @@ -636,7 +616,7 @@ fn test_describe_author() { ○ Test User test.user@example.com 2001-02-03 04:05:07.000 +07:00 │ Test User test.user@example.com 2001-02-03 04:05:07.000 +07:00 ~ - "###); + "); // Change the author for the latest commit (the committer is always reset) test_env.jj_cmd_ok( @@ -647,7 +627,7 @@ fn test_describe_author() { "Super Seeder ", ], ); - insta::assert_snapshot!(get_signatures(), @r#" + insta::assert_snapshot!(get_signatures(), @r" @ Super Seeder super.seeder@example.com 2001-02-03 04:05:12.000 +07:00 │ Test User test.user@example.com 2001-02-03 04:05:12.000 +07:00 ○ Test User test.user@example.com 2001-02-03 04:05:09.000 +07:00 @@ -657,16 +637,16 @@ fn test_describe_author() { ○ Test User test.user@example.com 2001-02-03 04:05:07.000 +07:00 │ Test User test.user@example.com 2001-02-03 04:05:07.000 +07:00 ~ - "#); + "); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" JJ: Author: Super Seeder (2001-02-03 08:05:12) JJ: Committer: Test User (2001-02-03 08:05:12) JJ: 0 files changed, 0 insertions(+), 0 deletions(-) JJ: Lines starting with "JJ:" (like this one) will be removed. - "###); + "#); // Change the author for multiple commits (the committer is always reset) test_env.jj_cmd_ok( @@ -680,7 +660,7 @@ fn test_describe_author() { "Super Seeder ", ], ); - insta::assert_snapshot!(get_signatures(), @r#" + insta::assert_snapshot!(get_signatures(), @r" @ Super Seeder super.seeder@example.com 2001-02-03 04:05:12.000 +07:00 │ Test User test.user@example.com 2001-02-03 04:05:14.000 +07:00 ○ Super Seeder super.seeder@example.com 2001-02-03 04:05:14.000 +07:00 @@ -690,7 +670,7 @@ fn test_describe_author() { ○ Super Seeder super.seeder@example.com 2001-02-03 04:05:14.000 +07:00 │ Test User test.user@example.com 2001-02-03 04:05:14.000 +07:00 ~ - "#); + "); // Reset the author for the latest commit (the committer is always reset) test_env.jj_cmd_ok( @@ -703,7 +683,7 @@ fn test_describe_author() { "--reset-author", ], ); - insta::assert_snapshot!(get_signatures(), @r#" + insta::assert_snapshot!(get_signatures(), @r" @ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:16.000 +07:00 │ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:16.000 +07:00 ○ Super Seeder super.seeder@example.com 2001-02-03 04:05:14.000 +07:00 @@ -713,7 +693,7 @@ fn test_describe_author() { ○ Super Seeder super.seeder@example.com 2001-02-03 04:05:14.000 +07:00 │ Test User test.user@example.com 2001-02-03 04:05:14.000 +07:00 ~ - "#); + "); // Reset the author for multiple commits (the committer is always reset) test_env.jj_cmd_ok( @@ -727,7 +707,7 @@ fn test_describe_author() { "--reset-author", ], ); - insta::assert_snapshot!(get_signatures(), @r#" + insta::assert_snapshot!(get_signatures(), @r" @ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:18.000 +07:00 │ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:18.000 +07:00 ○ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:18.000 +07:00 @@ -737,7 +717,7 @@ fn test_describe_author() { ○ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:18.000 +07:00 │ Ove Ridder ove.ridder@example.com 2001-02-03 04:05:18.000 +07:00 ~ - "#); + "); insta::assert_snapshot!( std::fs::read_to_string(test_env.env_root().join("editor")).unwrap(), @r#" JJ: Enter or edit commit descriptions after the `JJ: describe` lines. diff --git a/cli/tests/test_diff_command.rs b/cli/tests/test_diff_command.rs index c920075731..ebe47acca2 100644 --- a/cli/tests/test_diff_command.rs +++ b/cli/tests/test_diff_command.rs @@ -35,7 +35,7 @@ fn test_diff_basic() { std::fs::write(repo_path.join("file4"), "1\n2\n3\n4\n").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file2: 1 1: 1 2 2: 25 @@ -43,10 +43,10 @@ fn test_diff_basic() { 4 : 4 Modified regular file file3 (file1 => file3): Modified regular file file4 (file2 => file4): - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=0"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file2: 1 1: 1 2 2: 25 @@ -54,10 +54,10 @@ fn test_diff_basic() { 4 : 4 Modified regular file file3 (file1 => file3): Modified regular file file4 (file2 => file4): - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--color=debug"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" <> <><><><> <><><><><><><> @@ -65,27 +65,27 @@ fn test_diff_basic() { <><><> < file3):>> < file4):>> - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" M file2 R {file1 => file3} C {file2 => file4} - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--types"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" FF file2 FF {file1 => file3} FF {file2 => file4} - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--types", "glob:file[12]"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" F- file1 FF file2 - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "file1"]); insta::assert_snapshot!(stdout, @r" @@ -99,7 +99,7 @@ fn test_diff_basic() { "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file2 b/file2 index 94ebaf9001..1ffc51b472 100644 --- a/file2 @@ -116,7 +116,7 @@ fn test_diff_basic() { diff --git a/file2 b/file4 copy from file2 copy to file4 - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=0"]); insta::assert_snapshot!(stdout, @r" @@ -138,7 +138,7 @@ fn test_diff_basic() { "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--color=debug"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" <> <> <> @@ -155,10 +155,10 @@ fn test_diff_basic() { <> <> <> - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "--git"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" M file2 R {file1 => file3} C {file2 => file4} @@ -178,22 +178,22 @@ fn test_diff_basic() { diff --git a/file2 b/file4 copy from file2 copy to file4 - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file2 | 3 +-- {file1 => file3} | 0 {file2 => file4} | 0 3 files changed, 1 insertion(+), 2 deletions(-) - "###); + "); // Filter by glob pattern let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "glob:file[12]"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 - "###); + "); // Unmatched paths should generate warnings let (stdout, stderr) = test_env.jj_cmd_ok( @@ -208,14 +208,12 @@ fn test_diff_basic() { "repo/y/z", ], ); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" M repo/file2 R repo/{file1 => file3} C repo/{file2 => file4} - "###); - insta::assert_snapshot!(stderr.replace('\\', "/"), @r###" - Warning: No matching entries for paths: repo/x, repo/y/z - "###); + "); + insta::assert_snapshot!(stderr.replace('\\', "/"), @"Warning: No matching entries for paths: repo/x, repo/y/z"); // Unmodified paths shouldn't generate warnings let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diff", "-s", "--from=@", "file2"]); @@ -231,24 +229,24 @@ fn test_diff_empty() { std::fs::write(repo_path.join("file1"), "").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Added regular file file1: (empty) - "###); + "); test_env.jj_cmd_ok(&repo_path, &["new"]); std::fs::remove_file(repo_path.join("file1")).unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Removed regular file file1: (empty) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) - "###); + "); } #[test] @@ -282,7 +280,7 @@ fn test_diff_file_mode() { std::fs::remove_file(repo_path.join("file4")).unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@--"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Added executable file file1: (empty) Added executable file file2: @@ -291,18 +289,18 @@ fn test_diff_file_mode() { 1: 1 Added regular file file4: (empty) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@-"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Executable file became non-executable at file1: 1: 2 Executable file became non-executable at file2: Non-executable file became executable at file3: 1 1: 12 Non-executable file became executable at file4: - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Removed regular file file1: 1 : 2 Removed regular file file2: @@ -311,7 +309,7 @@ fn test_diff_file_mode() { 1 : 2 Removed executable file file4: (empty) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r@--", "--git"]); insta::assert_snapshot!(stdout, @r" @@ -439,24 +437,14 @@ fn test_diff_types() { ], ) }; - insta::assert_snapshot!(diff("missing", "file"), @r###" - -F foo - "###); - insta::assert_snapshot!(diff("file", "conflict"), @r###" - FC foo - "###); - insta::assert_snapshot!(diff("conflict", "missing"), @r###" - C- foo - "###); + insta::assert_snapshot!(diff("missing", "file"), @"-F foo"); + insta::assert_snapshot!(diff("file", "conflict"), @"FC foo"); + insta::assert_snapshot!(diff("conflict", "missing"), @"C- foo"); #[cfg(unix)] { - insta::assert_snapshot!(diff("symlink", "file"), @r###" - LF foo - "###); - insta::assert_snapshot!(diff("missing", "executable"), @r###" - -F foo - "###); + insta::assert_snapshot!(diff("symlink", "file"), @"LF foo"); + insta::assert_snapshot!(diff("missing", "executable"), @"-F foo"); } } @@ -469,10 +457,10 @@ fn test_diff_name_only() { test_env.jj_cmd_ok(&repo_path, &["new"]); std::fs::write(repo_path.join("deleted"), "d").unwrap(); std::fs::write(repo_path.join("modified"), "m").unwrap(); - insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--name-only"]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--name-only"]), @r" deleted modified - "###); + "); test_env.jj_cmd_ok(&repo_path, &["commit", "-mfirst"]); std::fs::remove_file(repo_path.join("deleted")).unwrap(); std::fs::write(repo_path.join("modified"), "mod").unwrap(); @@ -480,12 +468,12 @@ fn test_diff_name_only() { std::fs::create_dir(repo_path.join("sub")).unwrap(); std::fs::write(repo_path.join("sub/added"), "sub/add").unwrap(); insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--name-only"]).replace('\\', "/"), - @r###" + @r" added deleted modified sub/added - "###); + "); } #[test] @@ -495,22 +483,22 @@ fn test_diff_bad_args() { let repo_path = test_env.env_root().join("repo"); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["diff", "-s", "--types"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: the argument '--summary' cannot be used with '--types' Usage: jj diff --summary [FILESETS]... For more information, try '--help'. - "###); + "); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["diff", "--color-words", "--git"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: the argument '--color-words' cannot be used with '--git' Usage: jj diff --color-words [FILESETS]... For more information, try '--help'. - "###); + "); } #[test] @@ -541,7 +529,7 @@ fn test_diff_relative_paths() { let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff"]); #[cfg(unix)] - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file2: 1 1: foo2bar2 Modified regular file subdir1/file3: @@ -550,7 +538,7 @@ fn test_diff_relative_paths() { 1 1: foo4bar4 Modified regular file ../file1: 1 1: foo1bar1 - "###); + "); #[cfg(windows)] insta::assert_snapshot!(stdout, @r###" Modified regular file file2: @@ -565,12 +553,12 @@ fn test_diff_relative_paths() { let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "-s"]); #[cfg(unix)] - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" M file2 M subdir1/file3 M ../dir2/file4 M ../file1 - "###); + "); #[cfg(windows)] insta::assert_snapshot!(stdout, @r###" M file2 @@ -581,12 +569,12 @@ fn test_diff_relative_paths() { let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "--types"]); #[cfg(unix)] - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" FF file2 FF subdir1/file3 FF ../dir2/file4 FF ../file1 - "###); + "); #[cfg(windows)] insta::assert_snapshot!(stdout, @r###" FF file2 @@ -596,7 +584,7 @@ fn test_diff_relative_paths() { "###); let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "--git"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/dir1/file2 b/dir1/file2 index 54b060eee9..1fe912cdd8 100644 --- a/dir1/file2 @@ -625,17 +613,17 @@ fn test_diff_relative_paths() { @@ -1,1 +1,1 @@ -foo1 +bar1 - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "--stat"]); #[cfg(unix)] - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file2 | 2 +- subdir1/file3 | 2 +- ../dir2/file4 | 2 +- ../file1 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) - "###); + "); #[cfg(windows)] insta::assert_snapshot!(stdout, @r###" file2 | 2 +- @@ -663,7 +651,7 @@ fn test_diff_hunks() { std::fs::write(repo_path.join("file3"), "foo\nbar\nbaz quux blah blah\n").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1: 1: foo Modified regular file file2: @@ -672,10 +660,10 @@ fn test_diff_hunks() { 1 1: foo 2: bar 2 3: baz quxquux blah blah - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--color=debug"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" <> <><><><> <> @@ -684,7 +672,7 @@ fn test_diff_hunks() { <><><><> <><><><> <><><><><><><> - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); insta::assert_snapshot!(stdout, @r" @@ -853,7 +841,7 @@ fn test_diff_color_words_inlining_threshold() { // default let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1-single-line: 1 1: == adds == 2 2: a X b Y Z c @@ -896,10 +884,10 @@ fn test_diff_color_words_inlining_threshold() { 14 : c d e f g 13: X a Y b d 14: Z e - "###); + "); // -1: inline all - insta::assert_snapshot!(render_diff(-1, &[]), @r###" + insta::assert_snapshot!(render_diff(-1, &[]), @r" Modified regular file file1-single-line: 1 1: == adds == 2 2: a X b Y Z c @@ -938,10 +926,10 @@ fn test_diff_color_words_inlining_threshold() { 13 13: X a Y b 14 13: c d 14 14: Z e f g - "###); + "); // 0: no inlining - insta::assert_snapshot!(render_diff(0, &[]), @r###" + insta::assert_snapshot!(render_diff(0, &[]), @r" Modified regular file file1-single-line: 1 1: == adds == 2 : a b c @@ -995,10 +983,10 @@ fn test_diff_color_words_inlining_threshold() { 14 : c d e f g 13: X a Y b d 14: Z e - "###); + "); // 1: inline adds-only or removes-only lines - insta::assert_snapshot!(render_diff(1, &[]), @r###" + insta::assert_snapshot!(render_diff(1, &[]), @r" Modified regular file file1-single-line: 1 1: == adds == 2 2: a X b Y Z c @@ -1048,10 +1036,10 @@ fn test_diff_color_words_inlining_threshold() { 14 : c d e f g 13: X a Y b d 14: Z e - "###); + "); // 2: inline up to adds + removes lines - insta::assert_snapshot!(render_diff(2, &[]), @r###" + insta::assert_snapshot!(render_diff(2, &[]), @r" Modified regular file file1-single-line: 1 1: == adds == 2 2: a X b Y Z c @@ -1096,10 +1084,10 @@ fn test_diff_color_words_inlining_threshold() { 14 : c d e f g 13: X a Y b d 14: Z e - "###); + "); // 3: inline up to adds + removes + adds lines - insta::assert_snapshot!(render_diff(3, &[]), @r###" + insta::assert_snapshot!(render_diff(3, &[]), @r" Modified regular file file1-single-line: 1 1: == adds == 2 2: a X b Y Z c @@ -1142,10 +1130,10 @@ fn test_diff_color_words_inlining_threshold() { 14 : c d e f g 13: X a Y b d 14: Z e - "###); + "); // 4: inline up to adds + removes + adds + removes lines - insta::assert_snapshot!(render_diff(4, &[]), @r###" + insta::assert_snapshot!(render_diff(4, &[]), @r" Modified regular file file1-single-line: 1 1: == adds == 2 2: a X b Y Z c @@ -1184,10 +1172,10 @@ fn test_diff_color_words_inlining_threshold() { 13 13: X a Y b 14 13: c d 14 14: Z e f g - "###); + "); // context words in added/removed lines should be labeled as such - insta::assert_snapshot!(render_diff(2, &["--color=always"]), @r###" + insta::assert_snapshot!(render_diff(2, &["--color=always"]), @r" Modified regular file file1-single-line:  1  1: == adds ==  2  2: a X b Y Z c @@ -1232,8 +1220,8 @@ fn test_diff_color_words_inlining_threshold() {  14 : c d e f g  13: X a Y b d  14: Z e - "###); - insta::assert_snapshot!(render_diff(2, &["--color=debug"]), @r###" + "); + insta::assert_snapshot!(render_diff(2, &["--color=debug"]), @r" <> <><><><> <><><><><><><><> @@ -1278,7 +1266,7 @@ fn test_diff_color_words_inlining_threshold() { <><><><><><> <><><><><><><><> <><><><><> - "###); + "); } #[test] @@ -1294,17 +1282,17 @@ fn test_diff_missing_newline() { std::fs::write(repo_path.join("file2"), "foo").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1: 1 1: foo 2: bar Modified regular file file2: 1 1: foo 2 : bar - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file1 b/file1 index 1910281566..a907ec3f43 100644 --- a/file1 @@ -1325,14 +1313,14 @@ fn test_diff_missing_newline() { \ No newline at end of file +foo \ No newline at end of file - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file1 | 3 ++- file2 | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) - "###); + "); } #[test] @@ -1368,7 +1356,7 @@ fn test_color_words_diff_missing_newline() { "--reversed", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" === Empty Added regular file file1: (empty) @@ -1433,7 +1421,7 @@ fn test_color_words_diff_missing_newline() { 7 : g 8 : h 9 : I - "###); + "); let stdout = test_env.jj_cmd_success( &repo_path, @@ -1446,7 +1434,7 @@ fn test_color_words_diff_missing_newline() { "--reversed", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" === Empty Added regular file file1: (empty) @@ -1516,7 +1504,7 @@ fn test_color_words_diff_missing_newline() { 7 : g 8 : h 9 : I - "###); + "); } #[test] @@ -1552,7 +1540,7 @@ fn test_diff_ignore_whitespace() { // Git diff as reference output let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--ignore-all-space"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" diff --git a/file1 b/file1 index f532aa68ad..033c4a6168 100644 --- a/file1 @@ -1564,9 +1552,9 @@ fn test_diff_ignore_whitespace() { } +} baz { } - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--ignore-space-change"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" diff --git a/file1 b/file1 index f532aa68ad..033c4a6168 100644 --- a/file1 @@ -1580,26 +1568,26 @@ fn test_diff_ignore_whitespace() { } -baz {} +baz { } - "#); + "); // Diff-stat should respects the whitespace options let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat", "--ignore-all-space"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" file1 | 2 ++ 1 file changed, 2 insertions(+), 0 deletions(-) - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat", "--ignore-space-change"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" file1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) - "#); + "); // Word-level changes are still highlighted let stdout = test_env.jj_cmd_success( &repo_path, &["diff", "--color=always", "--ignore-all-space"], ); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" Modified regular file file1:  1: {  1  2:  foo { @@ -1607,12 +1595,12 @@ fn test_diff_ignore_whitespace() {  3  4:  }  5: }  4  6: baz { } - "#); + "); let stdout = test_env.jj_cmd_success( &repo_path, &["diff", "--color=always", "--ignore-space-change"], ); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" Modified regular file file1:  1: {  1  2:  foo { @@ -1620,7 +1608,7 @@ fn test_diff_ignore_whitespace() {  4:  }  3  5: }  4  6: baz { } - "#); + "); } #[test] @@ -1649,7 +1637,7 @@ fn test_diff_skipped_context() { &repo_path, &["log", "-Tdescription", "-p", "--no-graph", "--reversed"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" === Left side of diffs Added regular file file1: 1: a @@ -1731,7 +1719,7 @@ fn test_diff_skipped_context() { 8 8: h 9 9: i 10 10: j - "###); + "); } #[test] @@ -1757,7 +1745,7 @@ context = 0 &repo_path, &["log", "-Tdescription", "-p", "--no-graph", "--reversed"], ); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" === First commit Added regular file file1: 1: a @@ -1770,7 +1758,7 @@ context = 0 ... 3 3: cC ... - "#); + "); } #[test] @@ -1859,7 +1847,7 @@ fn test_diff_skipped_context_nondefault() { "--context=0", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" === Left side of diffs Added regular file file1: 1: a @@ -1893,7 +1881,7 @@ fn test_diff_skipped_context_nondefault() { ... 3 3: cC 4 4: d - "###); + "); } #[test] @@ -1917,7 +1905,7 @@ fn test_diff_leading_trailing_context() { // N=5 <= num_context_lines + 1: No room to skip. let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=4"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1: 1 1: 1 2 2: 2 @@ -1932,12 +1920,12 @@ fn test_diff_leading_trailing_context() { 10 10: 9 11 11: 10 12 12: 11 - "###); + "); // N=5 <= 2 * num_context_lines + 1: The last hunk wouldn't be split if // trailing diff existed. let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=3"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1: ... 3 3: 3 @@ -1950,12 +1938,12 @@ fn test_diff_leading_trailing_context() { 9 9: 8 10 10: 9 ... - "###); + "); // N=5 > 2 * num_context_lines + 1: The last hunk should be split no matter // if trailing diff existed. let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--context=1"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1: ... 5 5: 5 @@ -1964,11 +1952,11 @@ fn test_diff_leading_trailing_context() { 7: R 8 8: 7 ... - "###); + "); // N=5 <= num_context_lines: No room to skip. let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=5"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file1 b/file1 index 1bf57dee4a..69b3e1865c 100644 --- a/file1 @@ -1987,12 +1975,12 @@ fn test_diff_leading_trailing_context() { 9 10 11 - "###); + "); // N=5 <= 2 * num_context_lines: The last hunk wouldn't be split if // trailing diff existed. let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=3"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file1 b/file1 index 1bf57dee4a..69b3e1865c 100644 --- a/file1 @@ -2007,12 +1995,12 @@ fn test_diff_leading_trailing_context() { 7 8 9 - "###); + "); // N=5 > 2 * num_context_lines: The last hunk should be split no matter // if trailing diff existed. let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=2"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file1 b/file1 index 1bf57dee4a..69b3e1865c 100644 --- a/file1 @@ -2025,7 +2013,7 @@ fn test_diff_leading_trailing_context() { +R 7 8 - "###); + "); } #[test] @@ -2052,10 +2040,8 @@ fn test_diff_external_tool() { let mut insta_settings = insta::Settings::clone_current(); insta_settings.add_filter("exit (status|code)", ""); insta_settings.bind(|| { - insta::assert_snapshot!(stdout, @r""); - insta::assert_snapshot!(stderr, @r#" - Warning: Tool exited with : 1 (run with --debug to see the exact invocation) - "#); + insta::assert_snapshot!(stdout, @""); + insta::assert_snapshot!(stderr, @"Warning: Tool exited with : 1 (run with --debug to see the exact invocation)"); }); // nonzero exit codes should not print a warning if it's an expected exit code @@ -2069,8 +2055,8 @@ fn test_diff_external_tool() { "--config=merge-tools.fake-diff-editor.diff-expected-exit-codes=[1]", ], ); - insta::assert_snapshot!(stdout, @r""); - insta::assert_snapshot!(stderr, @r""); + insta::assert_snapshot!(stdout, @""); + insta::assert_snapshot!(stderr, @""); std::fs::write( &edit_script, @@ -2080,23 +2066,23 @@ fn test_diff_external_tool() { // diff without file patterns insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor"]), @r###" + test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor"]), @r" file1 file2 -- file2 file3 - "###); + "); // diff with file patterns insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor", "file1"]), @r###" + test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor", "file1"]), @r" file1 -- - "###); + "); insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &["log", "-p", "--tool=fake-diff-editor"]), @r###" + test_env.jj_cmd_success(&repo_path, &["log", "-p", "--tool=fake-diff-editor"]), @r" @ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 39d9055d │ (no description set) │ file1 @@ -2111,10 +2097,10 @@ fn test_diff_external_tool() { │ file2 ◆ zzzzzzzz root() 00000000 -- - "###); + "); insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &["show", "--tool=fake-diff-editor"]), @r#" + test_env.jj_cmd_success(&repo_path, &["show", "--tool=fake-diff-editor"]), @r" Commit ID: 39d9055d70873099fd924b9af218289d5663eac8 Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Author : Test User (2001-02-03 08:05:09) @@ -2127,41 +2113,39 @@ fn test_diff_external_tool() { -- file2 file3 - "#); + "); // Enabled by default, looks up the merge-tools table let config = "--config=ui.diff.tool=fake-diff-editor"; - insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", config]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", config]), @r" file1 file2 -- file2 file3 - "###); + "); // Inlined command arguments let command_toml = to_toml_value(fake_diff_editor_path()); let config = format!("--config=ui.diff.tool=[{command_toml}, '$right', '$left']"); - insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", &config]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", &config]), @r" file2 file3 -- file1 file2 - "###); + "); // Output of external diff tool shouldn't be escaped std::fs::write(&edit_script, "print \x1b[1;31mred").unwrap(); insta::assert_snapshot!( test_env.jj_cmd_success(&repo_path, &["diff", "--color=always", "--tool=fake-diff-editor"]), - @r###" - red - "###); + @"red"); // Non-zero exit code isn't an error std::fs::write(&edit_script, "print diff\0fail").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["show", "--tool=fake-diff-editor"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" Commit ID: 39d9055d70873099fd924b9af218289d5663eac8 Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Author : Test User (2001-02-03 08:05:09) @@ -2170,18 +2154,16 @@ fn test_diff_external_tool() { (no description set) diff - "#); - insta::assert_snapshot!(stderr.replace("exit code:", "exit status:"), @r###" - Warning: Tool exited with exit status: 1 (run with --debug to see the exact invocation) - "###); + "); + insta::assert_snapshot!(stderr.replace("exit code:", "exit status:"), @"Warning: Tool exited with exit status: 1 (run with --debug to see the exact invocation)"); // --tool=:builtin shouldn't be ignored let stderr = test_env.jj_cmd_failure(&repo_path, &["diff", "--tool=:builtin"]); - insta::assert_snapshot!(strip_last_line(&stderr), @r###" + insta::assert_snapshot!(strip_last_line(&stderr), @r" Error: Failed to generate diff Caused by: 1: Error executing ':builtin' (run with --debug to see the exact invocation) - "###); + "); } #[test] @@ -2213,7 +2195,7 @@ fn test_diff_external_file_by_file_tool() { // diff without file patterns insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &[&["diff"], configs].concat()), @r###" + test_env.jj_cmd_success(&repo_path, &[&["diff"], configs].concat()), @r" == file2 -- @@ -2226,19 +2208,19 @@ fn test_diff_external_file_by_file_tool() { file1 -- file4 - "###); + "); // diff with file patterns insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &[&["diff", "file1"], configs].concat()), @r###" + test_env.jj_cmd_success(&repo_path, &[&["diff", "file1"], configs].concat()), @r" == file1 -- file1 - "###); + "); insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &[&["log", "-p"], configs].concat()), @r###" + test_env.jj_cmd_success(&repo_path, &[&["log", "-p"], configs].concat()), @r" @ rlvkpnrz test.user@example.com 2001-02-03 08:05:09 7b01704a │ (no description set) │ == @@ -2264,10 +2246,10 @@ fn test_diff_external_file_by_file_tool() { │ -- │ file2 ◆ zzzzzzzz root() 00000000 - "###); + "); insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &[&["show"], configs].concat()), @r#" + test_env.jj_cmd_success(&repo_path, &[&["show"], configs].concat()), @r" Commit ID: 7b01704a670bc77d11ed117d362855cff1d4513b Change ID: rlvkpnrzqnoowoytxnquwvuryrwnrmlp Author : Test User (2001-02-03 08:05:09) @@ -2287,7 +2269,7 @@ fn test_diff_external_file_by_file_tool() { file1 -- file4 - "#); + "); } #[cfg(unix)] @@ -2318,13 +2300,13 @@ fn test_diff_external_tool_symlink() { // Shouldn't try to change permission of symlinks insta::assert_snapshot!( - test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor"]), @r###" + test_env.jj_cmd_success(&repo_path, &["diff", "--tool=fake-diff-editor"]), @r" dead file -- dead file - "###); + "); // External file should be intact assert_eq!( @@ -2421,7 +2403,7 @@ fn test_diff_external_tool_conflict_marker_style() { insta::assert_snapshot!(stderr, @""); // Conflicts should render using "snapshot" format insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("file")).unwrap(), @r##" + std::fs::read_to_string(test_env.env_root().join("file")).unwrap(), @r" line 1 line 2.1 line 2.2 @@ -2437,7 +2419,7 @@ fn test_diff_external_tool_conflict_marker_style() { line 4.3 >>>>>>> Conflict 1 of 1 ends line 5 - "##); + "); } #[test] @@ -2448,10 +2430,10 @@ fn test_diff_stat() { std::fs::write(repo_path.join("file1"), "foo\n").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file1 | 1 + 1 file changed, 1 insertion(+), 0 deletions(-) - "###); + "); test_env.jj_cmd_ok(&repo_path, &["new"]); @@ -2463,10 +2445,10 @@ fn test_diff_stat() { std::fs::write(repo_path.join("file1"), "bar\n").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file1 | 1 - 1 file changed, 0 insertions(+), 1 deletion(-) - "###); + "); } #[test] @@ -2490,97 +2472,97 @@ fn test_diff_stat_long_name_or_stat() { test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]) }; - insta::assert_snapshot!(get_stat(&test_env, 1, 1), @r###" + insta::assert_snapshot!(get_stat(&test_env, 1, 1), @r" 1 | 1 + 一 | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 1, 10), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 1, 10), @r" 1 | 10 ++++++++++ 一 | 10 ++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 1, 100), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 1, 100), @r" 1 | 100 +++++++++++++++++ 一 | 100 +++++++++++++++++ 2 files changed, 200 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 10, 1), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 10, 1), @r" 1234567890 | 1 + ...五六七八九十 | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 10, 10), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 10, 10), @r" 1234567890 | 10 +++++++ ...六七八九十 | 10 +++++++ 2 files changed, 20 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 10, 100), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 10, 100), @r" 1234567890 | 100 ++++++ ...六七八九十 | 100 ++++++ 2 files changed, 200 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 50, 1), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 50, 1), @r" ...901234567890 | 1 + ...五六七八九十 | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 50, 10), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 50, 10), @r" ...01234567890 | 10 +++++++ ...六七八九十 | 10 +++++++ 2 files changed, 20 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 50, 100), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 50, 100), @r" ...01234567890 | 100 ++++++ ...六七八九十 | 100 ++++++ 2 files changed, 200 insertions(+), 0 deletions(-) - "###); + "); // Lengths around where we introduce the ellipsis - insta::assert_snapshot!(get_stat(&test_env, 13, 100), @r###" + insta::assert_snapshot!(get_stat(&test_env, 13, 100), @r" 1234567890123 | 100 ++++++ ...九十一二三 | 100 ++++++ 2 files changed, 200 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 14, 100), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 14, 100), @r" 12345678901234 | 100 ++++++ ...十一二三四 | 100 ++++++ 2 files changed, 200 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 15, 100), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 15, 100), @r" ...56789012345 | 100 ++++++ ...一二三四五 | 100 ++++++ 2 files changed, 200 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 16, 100), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 16, 100), @r" ...67890123456 | 100 ++++++ ...二三四五六 | 100 ++++++ 2 files changed, 200 insertions(+), 0 deletions(-) - "###); + "); // Very narrow terminal (doesn't have to fit, just don't crash) test_env.add_env_var("COLUMNS", "10"); - insta::assert_snapshot!(get_stat(&test_env, 10, 10), @r###" + insta::assert_snapshot!(get_stat(&test_env, 10, 10), @r" ... | 10 ++ ... | 10 ++ 2 files changed, 20 insertions(+), 0 deletions(-) - "###); + "); test_env.add_env_var("COLUMNS", "3"); - insta::assert_snapshot!(get_stat(&test_env, 10, 10), @r###" + insta::assert_snapshot!(get_stat(&test_env, 10, 10), @r" ... | 10 ++ ... | 10 ++ 2 files changed, 20 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 3, 10), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 3, 10), @r" 123 | 10 ++ ... | 10 ++ 2 files changed, 20 insertions(+), 0 deletions(-) - "###); - insta::assert_snapshot!(get_stat(&test_env, 1, 10), @r###" + "); + insta::assert_snapshot!(get_stat(&test_env, 1, 10), @r" 1 | 10 ++ 一 | 10 ++ 2 files changed, 20 insertions(+), 0 deletions(-) - "###); + "); } #[test] @@ -2599,7 +2581,7 @@ fn test_diff_binary() { std::fs::write(repo_path.join("file4.png"), b"\0\0\0").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["diff"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Removed regular file file1.png: (binary) Modified regular file file2.png: @@ -2608,10 +2590,10 @@ fn test_diff_binary() { (binary) Added regular file file4.png: (binary) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file1.png b/file1.png deleted file mode 100644 index 2b65b23c22..0000000000 @@ -2627,14 +2609,14 @@ fn test_diff_binary() { new file mode 100644 index 0000000000..4227ca4e87 Binary files /dev/null and b/file4.png differ - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--stat"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file1.png | 3 --- file2.png | 5 ++--- file3.png | 3 +++ file4.png | 1 + 4 files changed, 6 insertions(+), 6 deletions(-) - "###); + "); } diff --git a/cli/tests/test_diffedit_command.rs b/cli/tests/test_diffedit_command.rs index 99279d5c73..b14779a4d7 100644 --- a/cli/tests/test_diffedit_command.rs +++ b/cli/tests/test_diffedit_command.rs @@ -45,23 +45,21 @@ fn test_diffedit() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("instrs")).unwrap(), @r###" + std::fs::read_to_string(test_env.env_root().join("instrs")).unwrap(), @r" You are editing changes in: kkmpptxz 3d4cce89 (no description set) The diff initially shows the commit's changes. Adjust the right side until it shows the contents you want. If you don't make any changes, then the operation will be aborted. - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 - "###); + "); // Try again with ui.diff-instructions=false std::fs::write(&edit_script, "files-before file1 file2\0files-after file2").unwrap(); @@ -70,14 +68,12 @@ fn test_diffedit() { &["diffedit", "--config=ui.diff-instructions=false"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 - "###); + "); // Try again with --tool= std::fs::write( @@ -94,59 +90,53 @@ fn test_diffedit() { ], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 - "###); + "); // Nothing happens if the diff-editor exits with an error std::fs::write(&edit_script, "rm file2\0fail").unwrap(); let stderr = &test_env.jj_cmd_failure(&repo_path, &["diffedit"]); - insta::assert_snapshot!(stderr.replace("exit code:", "exit status:"), @r###" + insta::assert_snapshot!(stderr.replace("exit code:", "exit status:"), @r" Error: Failed to edit diff Caused by: Tool exited with exit status: 1 (run with --debug to see the exact invocation) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 - "###); + "); // Can edit changes to individual files std::fs::write(&edit_script, "reset file2").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created kkmpptxz cbc7a725 (no description set) Working copy now at: kkmpptxz cbc7a725 (no description set) Parent commit : rlvkpnrz a72506cd (no description set) Added 0 files, modified 1 files, removed 0 files - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" - D file1 - "###); + insta::assert_snapshot!(stdout, @"D file1"); // Changes to a commit are propagated to descendants test_env.jj_cmd_ok(&repo_path, &["undo"]); std::fs::write(&edit_script, "write file3\nmodified\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit", "-r", "@-"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created rlvkpnrz d4eef3fc (no description set) Rebased 1 descendant commits Working copy now at: kkmpptxz 59ef1b95 (no description set) Parent commit : rlvkpnrz d4eef3fc (no description set) Added 0 files, modified 1 files, removed 0 files - "###); + "); let contents = String::from_utf8(std::fs::read(repo_path.join("file3")).unwrap()).unwrap(); - insta::assert_snapshot!(contents, @r###" - modified - "###); + insta::assert_snapshot!(contents, @"modified"); // Test diffedit --from @-- test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -157,17 +147,17 @@ fn test_diffedit() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit", "--from", "@--"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created kkmpptxz 5b585bd1 (no description set) Working copy now at: kkmpptxz 5b585bd1 (no description set) Parent commit : rlvkpnrz a72506cd (no description set) Added 0 files, modified 0 files, removed 1 files - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 D file2 - "###); + "); } #[test] @@ -191,30 +181,28 @@ fn test_diffedit_new_file() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 A file2 - "###); + "); // Creating `file1` on the right side is noticed by `jj diffedit` std::fs::write(&edit_script, "write file1\nmodified\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created rlvkpnrz b0376e2b (no description set) Working copy now at: rlvkpnrz b0376e2b (no description set) Parent commit : qpvuntsm b739eb46 (no description set) Added 1 files, modified 0 files, removed 0 files - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" M file1 A file2 - "###); + "); // Creating a file that wasn't on either side is ignored by diffedit. // TODO(ilyagr) We should decide whether we like this behavior. @@ -226,14 +214,12 @@ fn test_diffedit_new_file() { std::fs::write(&edit_script, "write new_file\nnew file\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 A file2 - "###); + "); } #[test] @@ -329,7 +315,7 @@ fn test_diffedit_external_tool_conflict_marker_style() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created mzvwutvl fb39e804 (conflict) (empty) (no description set) Working copy now at: mzvwutvl fb39e804 (conflict) (empty) (no description set) Parent commit : rlvkpnrz 3765cc27 side-a @@ -339,10 +325,10 @@ fn test_diffedit_external_tool_conflict_marker_style() { file 2-sided conflict Existing conflicts were resolved or abandoned from these commits: mzvwutvl hidden a813239f (conflict) (no description set) - "###); + "); // Conflicts should render using "snapshot" format in diff editor insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("before-file")).unwrap(), @r##" + std::fs::read_to_string(test_env.env_root().join("before-file")).unwrap(), @r" line 1 <<<<<<< Conflict 1 of 2 +++++++ Contents of side #1 @@ -364,9 +350,9 @@ fn test_diffedit_external_tool_conflict_marker_style() { line 4.3 >>>>>>> Conflict 2 of 2 ends line 5 - "##); + "); insta::assert_snapshot!( - std::fs::read_to_string(test_env.env_root().join("after-file")).unwrap(), @r##" + std::fs::read_to_string(test_env.env_root().join("after-file")).unwrap(), @r" line 1 line 2.1 line 2.2 @@ -382,10 +368,10 @@ fn test_diffedit_external_tool_conflict_marker_style() { line 4.3 >>>>>>> Conflict 1 of 1 ends line 5 - "##); + "); // Conflicts should be materialized using "diff" format in working copy insta::assert_snapshot!( - std::fs::read_to_string(&file_path).unwrap(), @r##" + std::fs::read_to_string(&file_path).unwrap(), @r" line 1 <<<<<<< Conflict 1 of 2 +++++++ Contents of side #1 @@ -405,18 +391,18 @@ fn test_diffedit_external_tool_conflict_marker_style() { line 4.3 >>>>>>> Conflict 2 of 2 ends line 5 - "##); + "); // File should be conflicted with no changes let stdout = test_env.jj_cmd_success(&repo_path, &["st"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" The working copy is clean There are unresolved conflicts at these paths: file 2-sided conflict Working copy : mzvwutvl fb39e804 (conflict) (empty) (no description set) Parent commit: rlvkpnrz 3765cc27 side-a Parent commit: zsuskuln 8b3de837 side-b - "###); + "); } #[test] @@ -453,28 +439,24 @@ fn test_diffedit_3pane() { &["diffedit", "--config", config_with_output_as_after], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 - "###); + "); // Nothing happens if we make no changes, `config_with_right_as_after` version let (stdout, stderr) = test_env.jj_cmd_ok( &repo_path, &["diffedit", "--config", config_with_right_as_after], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 - "###); + "); // Can edit changes to individual files std::fs::write(&edit_script, "reset file2").unwrap(); @@ -483,16 +465,14 @@ fn test_diffedit_3pane() { &["diffedit", "--config", config_with_output_as_after], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created kkmpptxz ed8aada3 (no description set) Working copy now at: kkmpptxz ed8aada3 (no description set) Parent commit : rlvkpnrz a72506cd (no description set) Added 0 files, modified 1 files, removed 0 files - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" - D file1 - "###); + insta::assert_snapshot!(stdout, @"D file1"); // Can write something new to `file1` test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -502,17 +482,17 @@ fn test_diffedit_3pane() { &["diffedit", "--config", config_with_output_as_after], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created kkmpptxz 7c19e689 (no description set) Working copy now at: kkmpptxz 7c19e689 (no description set) Parent commit : rlvkpnrz a72506cd (no description set) Added 1 files, modified 0 files, removed 0 files - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" M file1 M file2 - "###); + "); // But nothing happens if we modify the right side test_env.jj_cmd_ok(&repo_path, &["undo"]); @@ -522,14 +502,12 @@ fn test_diffedit_3pane() { &["diffedit", "--config", config_with_right_as_after], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 - "###); + "); // TODO: test with edit_script of "reset file2". This fails on right side // since the file is readonly. @@ -558,10 +536,10 @@ fn test_diffedit_merge() { test_env.jj_cmd_ok(&repo_path, &["new"]); // Test the setup let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-r", "@-", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" M file1 A file3 - "###); + "); let edit_script = test_env.set_up_fake_diff_editor(); @@ -573,7 +551,7 @@ fn test_diffedit_merge() { .unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit", "-r", "@-"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created royxmykx 0105de4a (conflict) merge Rebased 1 descendant commits Working copy now at: yqosqzyt abbb78c1 (conflict) (empty) (no description set) @@ -581,15 +559,15 @@ fn test_diffedit_merge() { Added 0 files, modified 0 files, removed 1 files There are unresolved conflicts at these paths: file2 2-sided conflict - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s", "-r", "@-"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 A file3 - "###); + "); assert!(!repo_path.join("file1").exists()); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" <<<<<<< Conflict 1 of 1 %%%%%%% Changes from base to side #1 -a @@ -597,7 +575,7 @@ fn test_diffedit_merge() { +++++++ Contents of side #2 b >>>>>>> Conflict 1 of 1 ends - "###); + "); } #[test] @@ -618,56 +596,52 @@ fn test_diffedit_old_restore_interactive_tests() { // Nothing happens if we make no changes let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit", "--from", "@-"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 C {file2 => file3} - "###); + "); // Nothing happens if the diff-editor exits with an error std::fs::write(&edit_script, "rm file2\0fail").unwrap(); let stderr = test_env.jj_cmd_failure(&repo_path, &["diffedit", "--from", "@-"]); - insta::assert_snapshot!(stderr.replace("exit code:", "exit status:"), @r###" + insta::assert_snapshot!(stderr.replace("exit code:", "exit status:"), @r" Error: Failed to edit diff Caused by: Tool exited with exit status: 1 (run with --debug to see the exact invocation) - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" D file1 M file2 C {file2 => file3} - "###); + "); // Can restore changes to individual files std::fs::write(&edit_script, "reset file2\0reset file3").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit", "--from", "@-"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created rlvkpnrz 69811eda (no description set) Working copy now at: rlvkpnrz 69811eda (no description set) Parent commit : qpvuntsm fc687cb8 (no description set) Added 0 files, modified 1 files, removed 1 files - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" - D file1 - "###); + insta::assert_snapshot!(stdout, @"D file1"); // Can make unrelated edits test_env.jj_cmd_ok(&repo_path, &["undo"]); std::fs::write(&edit_script, "write file3\nunrelated\n").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["diffedit", "--from", "@-"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created rlvkpnrz 2b76a42e (no description set) Working copy now at: rlvkpnrz 2b76a42e (no description set) Parent commit : qpvuntsm fc687cb8 (no description set) Added 0 files, modified 1 files, removed 0 files - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); insta::assert_snapshot!(stdout, @r" diff --git a/file1 b/file1 @@ -715,12 +689,12 @@ fn test_diffedit_restore_descendants() { &["diffedit", "-r", "@-", "--restore-descendants"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Created rlvkpnrz 62b8c2ce (no description set) Rebased 1 descendant commits (while preserving their content) Working copy now at: kkmpptxz 321d1cd1 (no description set) Parent commit : rlvkpnrz 62b8c2ce (no description set) - "#); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]); insta::assert_snapshot!(stdout, @r#" diff --git a/file b/file diff --git a/cli/tests/test_duplicate_command.rs b/cli/tests/test_duplicate_command.rs index abaf373fcb..a3a19e1088 100644 --- a/cli/tests/test_duplicate_command.rs +++ b/cli/tests/test_duplicate_command.rs @@ -38,31 +38,25 @@ fn test_duplicate() { create_commit(&test_env, &repo_path, "b", &[]); create_commit(&test_env, &repo_path, "c", &["a", "b"]); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 17a00fc21654 c ├─╮ │ ○ d370aee184ba b ○ │ 2443ea76b0b1 a ├─╯ ◆ 000000000000 - "###); + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["duplicate", "all()"]); - insta::assert_snapshot!(stderr, @r###" - Error: Cannot duplicate the root commit - "###); + insta::assert_snapshot!(stderr, @"Error: Cannot duplicate the root commit"); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "none()"]); - insta::assert_snapshot!(stderr, @r###" - No revisions to duplicate. - "###); + insta::assert_snapshot!(stderr, @"No revisions to duplicate."); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Duplicated 2443ea76b0b1 as kpqxywon f5b1e687 a - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(stderr, @"Duplicated 2443ea76b0b1 as kpqxywon f5b1e687 a"); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 17a00fc21654 c ├─╮ │ ○ d370aee184ba b @@ -71,19 +65,15 @@ fn test_duplicate() { │ ○ f5b1e68729d6 a ├─╯ ◆ 000000000000 - "#); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["undo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" - Undid operation: b5bdbb51ab28 (2001-02-03 08:05:17) duplicate 1 commit(s) - "#); + insta::assert_snapshot!(stderr, @"Undid operation: b5bdbb51ab28 (2001-02-03 08:05:17) duplicate 1 commit(s)"); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate" /* duplicates `c` */]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Duplicated 17a00fc21654 as lylxulpl ef3b0f3d c - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(stderr, @"Duplicated 17a00fc21654 as lylxulpl ef3b0f3d c"); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 17a00fc21654 c ├─╮ │ │ ○ ef3b0f3d1046 c @@ -92,7 +82,7 @@ fn test_duplicate() { ○ │ 2443ea76b0b1 a ├─╯ ◆ 000000000000 - "#); + "); } #[test] @@ -107,7 +97,7 @@ fn test_duplicate_many() { create_commit(&test_env, &repo_path, "d", &["c"]); create_commit(&test_env, &repo_path, "e", &["b", "d"]); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 921dde6e55c0 e ├─╮ │ ○ ebd06dba20ec d @@ -116,15 +106,15 @@ fn test_duplicate_many() { ├─╯ ○ 2443ea76b0b1 a ◆ 000000000000 - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "b::"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Duplicated 1394f625cbbd as wqnwkozp 3b74d969 b Duplicated 921dde6e55c0 as mouksmqu 8348ddce e - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 921dde6e55c0 e ├─╮ ○ │ 1394f625cbbd b @@ -137,16 +127,14 @@ fn test_duplicate_many() { ├───╯ ○ 2443ea76b0b1 a ◆ 000000000000 - "#); + "); // Try specifying the same commit twice directly test_env.jj_cmd_ok(&repo_path, &["undo"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "b", "b"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Duplicated 1394f625cbbd as nkmrtpmo 0276d3d7 b - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(stderr, @"Duplicated 1394f625cbbd as nkmrtpmo 0276d3d7 b"); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 921dde6e55c0 e ├─╮ │ ○ ebd06dba20ec d @@ -157,18 +145,18 @@ fn test_duplicate_many() { ├─╯ ○ 2443ea76b0b1 a ◆ 000000000000 - "#); + "); // Try specifying the same commit twice indirectly test_env.jj_cmd_ok(&repo_path, &["undo"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "b::", "d::"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Duplicated 1394f625cbbd as xtnwkqum fa167d18 b Duplicated ebd06dba20ec as pqrnrkux 2181781b d Duplicated 921dde6e55c0 as ztxkyksq 0f7430f2 e - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 921dde6e55c0 e ├─╮ │ ○ ebd06dba20ec d @@ -183,11 +171,11 @@ fn test_duplicate_many() { ├───╯ ○ 2443ea76b0b1 a ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["undo"]); // Reminder of the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 921dde6e55c0 e ├─╮ │ ○ ebd06dba20ec d @@ -196,15 +184,15 @@ fn test_duplicate_many() { ├─╯ ○ 2443ea76b0b1 a ◆ 000000000000 - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "d::", "a"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Duplicated 2443ea76b0b1 as nlrtlrxv c6f7f8c4 a Duplicated ebd06dba20ec as plymsszl d94e4c55 d Duplicated 921dde6e55c0 as urrlptpw 9bd4389f e - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 921dde6e55c0 e ├─╮ │ ○ ebd06dba20ec d @@ -219,20 +207,20 @@ fn test_duplicate_many() { │ ○ c6f7f8c4512e a ├─╯ ◆ 000000000000 - "#); + "); // Check for BUG -- makes too many 'a'-s, etc. test_env.jj_cmd_ok(&repo_path, &["undo"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a::"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Duplicated 2443ea76b0b1 as uuuvxpvw 0fe67a05 a Duplicated 1394f625cbbd as nmpuuozl e13ac0ad b Duplicated c0cb3a0b73e7 as kzpokyyw df53fa58 c Duplicated ebd06dba20ec as yxrlprzz 2f2442db d Duplicated 921dde6e55c0 as mvkzkxrl ee8fe64e e - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 921dde6e55c0 e ├─╮ │ ○ ebd06dba20ec d @@ -249,7 +237,7 @@ fn test_duplicate_many() { │ ○ 0fe67a05989e a ├─╯ ◆ 000000000000 - "#); + "); } #[test] @@ -267,7 +255,7 @@ fn test_duplicate_destination() { let setup_opid = test_env.current_operation_id(&repo_path); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ f7550bb42c6f d │ ○ b75b7aa4b90e c ├─╯ @@ -278,7 +266,7 @@ fn test_duplicate_destination() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); // Duplicate a single commit onto a single destination. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "-d", "c"]); @@ -466,7 +454,7 @@ fn test_duplicate_insert_after() { let setup_opid = test_env.current_operation_id(&repo_path); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 0cdd923e993a d2 ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 @@ -481,7 +469,7 @@ fn test_duplicate_insert_after() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); // Duplicate a single commit after a single commit with no direct relationship. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "--after", "b1"]); @@ -902,13 +890,13 @@ fn test_duplicate_insert_after() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a2", "a3", "--after", "a1"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: Duplicating commit 17072aa2b823 as an ancestor of itself Warning: Duplicating commit 47df67757a64 as an ancestor of itself Duplicated 47df67757a64 as sukptuzs 4324d289 a2 Duplicated 17072aa2b823 as rxnrppxl 47586b09 a3 Rebased 3 commits onto duplicated commits - "#); + "); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 0cdd923e993a d2 ○ 0f21c5e185c5 d1 @@ -1068,9 +1056,7 @@ fn test_duplicate_insert_after() { &repo_path, &["duplicate", "a1", "--after", "b1", "--after", "b2"], ); - insta::assert_snapshot!(stderr, @r#" - Error: Refusing to create a loop: commit 7b44470918f4 would be both an ancestor and a descendant of the duplicated commits - "#); + insta::assert_snapshot!(stderr, @"Error: Refusing to create a loop: commit 7b44470918f4 would be both an ancestor and a descendant of the duplicated commits"); } #[test] @@ -1092,7 +1078,7 @@ fn test_duplicate_insert_before() { let setup_opid = test_env.current_operation_id(&repo_path); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 0cdd923e993a d2 ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 @@ -1107,7 +1093,7 @@ fn test_duplicate_insert_before() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); // Duplicate a single commit before a single commit with no direct relationship. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "--before", "b2"]); @@ -1290,11 +1276,11 @@ fn test_duplicate_insert_before() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a1", "b1", "--before", "c1"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Duplicated 9e85a474f005 as sryyqqkq fa625d74 a1 Duplicated dcc98bc8bbea as pxnqtknr 2233b9a8 b1 Rebased 2 commits onto duplicated commits - "#); + "); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 0cdd923e993a d2 ○ 0f21c5e185c5 d1 @@ -1390,15 +1376,15 @@ fn test_duplicate_insert_before() { &["duplicate", "a1", "b1", "--before", "c1", "--before", "d1"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Duplicated 9e85a474f005 as knltnxnu 056a0cb3 a1 Duplicated dcc98bc8bbea as krtqozmx fb68a539 b1 Rebased 4 commits onto duplicated commits Working copy now at: nmzmmopx 89f9b379 d2 | d2 Parent commit : xznxytkn 771d0e16 d1 | d1 Added 2 files, modified 0 files, removed 0 files - "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 89f9b37923a9 d2 ○ 771d0e16b40c d1 ├─╮ @@ -1417,7 +1403,7 @@ fn test_duplicate_insert_before() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["op", "restore", &setup_opid]); // Duplicate multiple commits without a direct ancestry relationship before @@ -1700,9 +1686,7 @@ fn test_duplicate_insert_before() { &repo_path, &["duplicate", "a1", "--before", "b1", "--before", "b2"], ); - insta::assert_snapshot!(stderr, @r#" - Error: Refusing to create a loop: commit dcc98bc8bbea would be both an ancestor and a descendant of the duplicated commits - "#); + insta::assert_snapshot!(stderr, @"Error: Refusing to create a loop: commit dcc98bc8bbea would be both an ancestor and a descendant of the duplicated commits"); } #[test] @@ -1724,7 +1708,7 @@ fn test_duplicate_insert_after_before() { let setup_opid = test_env.current_operation_id(&repo_path); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 0cdd923e993a d2 ○ 0f21c5e185c5 d1 │ ○ 09560d60cac4 c2 @@ -1739,7 +1723,7 @@ fn test_duplicate_insert_after_before() { │ ○ 9e85a474f005 a1 ├─╯ ◆ 000000000000 - "#); + "); // Duplicate a single commit in between commits with no direct relationship. let (stdout, stderr) = test_env.jj_cmd_ok( @@ -1903,10 +1887,10 @@ fn test_duplicate_insert_after_before() { &["duplicate", "a2", "--after", "a1", "--before", "a4"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Duplicated 47df67757a64 as xpnwykqz 54cc0161 a2 Rebased 1 commits onto duplicated commits - "#); + "); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 0cdd923e993a d2 ○ 0f21c5e185c5 d1 @@ -2127,11 +2111,11 @@ fn test_duplicate_insert_after_before() { &["duplicate", "a3", "a4", "--after", "a2", "--before", "c2"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Duplicated 17072aa2b823 as quyylypw d4d3c907 a3 Duplicated 196bc1f0efc1 as prukwozq 96798f1b a4 Rebased 1 commits onto duplicated commits - "#); + "); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 0cdd923e993a d2 ○ 0f21c5e185c5 d1 @@ -2263,11 +2247,11 @@ fn test_duplicate_insert_after_before() { &["duplicate", "a2", "a3", "--after", "a1", "--before", "a4"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Duplicated 47df67757a64 as nwmqwkzz 8517eaa7 a2 Duplicated 17072aa2b823 as uwrrnrtx 3ce18231 a3 Rebased 1 commits onto duplicated commits - "#); + "); insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 0cdd923e993a d2 ○ 0f21c5e185c5 d1 @@ -2295,9 +2279,7 @@ fn test_duplicate_insert_after_before() { &repo_path, &["duplicate", "a1", "--after", "b2", "--before", "b1"], ); - insta::assert_snapshot!(stderr, @r#" - Error: Refusing to create a loop: commit 7b44470918f4 would be both an ancestor and a descendant of the duplicated commits - "#); + insta::assert_snapshot!(stderr, @"Error: Refusing to create a loop: commit 7b44470918f4 would be both an ancestor and a descendant of the duplicated commits"); } // https://github.com/jj-vcs/jj/issues/1050 @@ -2308,32 +2290,28 @@ fn test_undo_after_duplicate() { let repo_path = test_env.env_root().join("repo"); create_commit(&test_env, &repo_path, "a", &[]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 2443ea76b0b1 a ◆ 000000000000 - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "a"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Duplicated 2443ea76b0b1 as mzvwutvl f5cefcbb a - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(stderr, @"Duplicated 2443ea76b0b1 as mzvwutvl f5cefcbb a"); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 2443ea76b0b1 a │ ○ f5cefcbb65a4 a ├─╯ ◆ 000000000000 - "#); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["undo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" - Undid operation: e3dbefa46ed5 (2001-02-03 08:05:11) duplicate 1 commit(s) - "#); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"Undid operation: e3dbefa46ed5 (2001-02-03 08:05:11) duplicate 1 commit(s)"); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 2443ea76b0b1 a ◆ 000000000000 - "###); + "); } // https://github.com/jj-vcs/jj/issues/694 @@ -2347,24 +2325,20 @@ fn test_rebase_duplicates() { create_commit(&test_env, &repo_path, "b", &["a"]); create_commit(&test_env, &repo_path, "c", &["b"]); // Test the setup - insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r" @ 7e4fbf4f2759 c @ 2001-02-03 04:05:13.000 +07:00 ○ 1394f625cbbd b @ 2001-02-03 04:05:11.000 +07:00 ○ 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00 ◆ 000000000000 @ 1970-01-01 00:00:00.000 +00:00 - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "c"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Duplicated 7e4fbf4f2759 as yostqsxw 0ac2063b c - "###); + insta::assert_snapshot!(stderr, @"Duplicated 7e4fbf4f2759 as yostqsxw 0ac2063b c"); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["duplicate", "c"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Duplicated 7e4fbf4f2759 as znkkpsqq ce5f4eeb c - "###); - insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r#" + insta::assert_snapshot!(stderr, @"Duplicated 7e4fbf4f2759 as znkkpsqq ce5f4eeb c"); + insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r" @ 7e4fbf4f2759 c @ 2001-02-03 04:05:13.000 +07:00 │ ○ ce5f4eeb69d1 c @ 2001-02-03 04:05:16.000 +07:00 ├─╯ @@ -2373,19 +2347,19 @@ fn test_rebase_duplicates() { ○ 1394f625cbbd b @ 2001-02-03 04:05:11.000 +07:00 ○ 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00 ◆ 000000000000 @ 1970-01-01 00:00:00.000 +00:00 - "#); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["rebase", "-s", "b", "-d", "root()"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Rebased 4 commits onto destination Working copy now at: royxmykx ed671a3c c | c Parent commit : zsuskuln 4c6f1569 b | b Added 0 files, modified 0 files, removed 1 files - "#); + "); // Some of the duplicate commits' timestamps were changed a little to make them // have distinct commit ids. - insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output_with_ts(&test_env, &repo_path), @r" @ ed671a3cbf35 c @ 2001-02-03 04:05:18.000 +07:00 │ ○ b86e9f27d085 c @ 2001-02-03 04:05:16.000 +07:00 ├─╯ @@ -2395,7 +2369,7 @@ fn test_rebase_duplicates() { │ ○ 2443ea76b0b1 a @ 2001-02-03 04:05:09.000 +07:00 ├─╯ ◆ 000000000000 @ 1970-01-01 00:00:00.000 +00:00 - "#); + "); } fn get_log_output(test_env: &TestEnvironment, repo_path: &Path) -> String { diff --git a/cli/tests/test_edit_command.rs b/cli/tests/test_edit_command.rs index f83fbe448a..c7017eebfa 100644 --- a/cli/tests/test_edit_command.rs +++ b/cli/tests/test_edit_command.rs @@ -28,43 +28,41 @@ fn test_edit() { // Errors out without argument let stderr = test_env.jj_cmd_cli_error(&repo_path, &["edit"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: the following required arguments were not provided: Usage: jj edit For more information, try '--help'. - "###); + "); // Makes the specified commit the working-copy commit let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["edit", "@-"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 73383c0b first Parent commit : zzzzzzzz 00000000 (empty) (no description set) Added 0 files, modified 1 files, removed 0 files - "###); + "); let (stdout, stderr) = get_log_output_with_stderr(&test_env, &repo_path); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ○ 2c910ae2d628 second @ 73383c0b6439 first ◆ 000000000000 - "###); + "); insta::assert_snapshot!(stderr, @""); insta::assert_snapshot!(read_file(&repo_path.join("file1")), @"0"); // Changes in the working copy are amended into the commit std::fs::write(repo_path.join("file2"), "0").unwrap(); let (stdout, stderr) = get_log_output_with_stderr(&test_env, &repo_path); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ○ b384b2cc1883 second @ ff3f7b0dc386 first ◆ 000000000000 - "###); - insta::assert_snapshot!(stderr, @r###" - Rebased 1 descendant commits onto updated working copy - "###); + "); + insta::assert_snapshot!(stderr, @"Rebased 1 descendant commits onto updated working copy"); } #[test] @@ -101,13 +99,13 @@ fn test_edit_current_wc_commit_missing() { .jj_cmd(&repo_path, &["edit", "--ignore-working-copy", &wc_child_id]) .assert() .code(255); - insta::assert_snapshot!(get_stderr_string(&assert), @r###" + insta::assert_snapshot!(get_stderr_string(&assert), @r" Internal error: Failed to edit a commit Caused by: 1: Current working-copy commit not found 2: Object fa15625b4a986997697639dfc2844138900c79f2 of type commit not found 3: An object with id fa15625b4a986997697639dfc2844138900c79f2 could not be found - "###); + "); } fn read_file(path: &Path) -> String { diff --git a/cli/tests/test_evolog_command.rs b/cli/tests/test_evolog_command.rs index 453beabe17..765be693cc 100644 --- a/cli/tests/test_evolog_command.rs +++ b/cli/tests/test_evolog_command.rs @@ -29,7 +29,7 @@ fn test_evolog_with_or_without_diff() { std::fs::write(repo_path.join("file1"), "resolved\n").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["evolog"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 │ my description × rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict @@ -38,11 +38,11 @@ fn test_evolog_with_or_without_diff() { │ my description ○ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f (empty) my description - "###); + "); // Color let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "evolog"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 │ my description × rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict @@ -51,12 +51,12 @@ fn test_evolog_with_or_without_diff() { │ my description ○ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f (empty) my description - "###); + "); // There should be no diff caused by the rebase because it was a pure rebase // (even even though it resulted in a conflict). let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "-p"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 │ my description │ Resolved conflict in file1: @@ -78,20 +78,20 @@ fn test_evolog_with_or_without_diff() { │ 1: foo ○ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f (empty) my description - "###); + "); // Test `--limit` let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--limit=2"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 │ my description × rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict │ my description - "###); + "); // Test `--no-graph` let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--no-graph"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 my description rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict @@ -100,11 +100,11 @@ fn test_evolog_with_or_without_diff() { my description rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f (empty) my description - "###); + "); // Test `--git` format, and that it implies `-p` let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--no-graph", "--git"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 my description diff --git a/file1 b/file1 @@ -140,7 +140,7 @@ fn test_evolog_with_or_without_diff() { +foo rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f (empty) my description - "###); + "); } #[test] @@ -159,7 +159,7 @@ fn test_evolog_with_custom_symbols() { let config = "templates.log_node='if(current_working_copy, \"$\", \"┝\")'"; let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "--config", config]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" $ rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3 │ my description ┝ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 07b18245 conflict @@ -168,7 +168,7 @@ fn test_evolog_with_custom_symbols() { │ my description ┝ rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:08 2b023b5f (empty) my description - "###); + "); } #[test] @@ -193,34 +193,34 @@ fn test_evolog_word_wrap() { test_env.jj_cmd_ok(&repo_path, &["describe", "-m", "first"]); // ui.log-word-wrap option applies to both graph/no-graph outputs - insta::assert_snapshot!(render(&["evolog"], 40, false), @r###" + insta::assert_snapshot!(render(&["evolog"], 40, false), @r" @ qpvuntsm test.user@example.com 2001-02-03 08:05:08 fa15625b │ (empty) first ○ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 (empty) (no description set) - "###); - insta::assert_snapshot!(render(&["evolog"], 40, true), @r###" + "); + insta::assert_snapshot!(render(&["evolog"], 40, true), @r" @ qpvuntsm test.user@example.com │ 2001-02-03 08:05:08 fa15625b │ (empty) first ○ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 (empty) (no description set) - "###); - insta::assert_snapshot!(render(&["evolog", "--no-graph"], 40, false), @r###" + "); + insta::assert_snapshot!(render(&["evolog", "--no-graph"], 40, false), @r" qpvuntsm test.user@example.com 2001-02-03 08:05:08 fa15625b (empty) first qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 (empty) (no description set) - "###); - insta::assert_snapshot!(render(&["evolog", "--no-graph"], 40, true), @r###" + "); + insta::assert_snapshot!(render(&["evolog", "--no-graph"], 40, true), @r" qpvuntsm test.user@example.com 2001-02-03 08:05:08 fa15625b (empty) first qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 (empty) (no description set) - "###); + "); } #[test] @@ -264,7 +264,7 @@ fn test_evolog_squash() { let stdout = test_env.jj_cmd_success(&repo_path, &["evolog", "-p", "-r", "description('squash')"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ○ qpvuntsm test.user@example.com 2001-02-03 08:05:15 d49749bf ├─┬─╮ squashed 3 │ │ ○ vruxwmqv hidden test.user@example.com 2001-02-03 08:05:15 8f2ae2b5 @@ -316,7 +316,7 @@ fn test_evolog_squash() { │ (empty) first ○ qpvuntsm hidden test.user@example.com 2001-02-03 08:05:07 230dd059 (empty) (no description set) - "###); + "); } #[test] diff --git a/cli/tests/test_file_chmod_command.rs b/cli/tests/test_file_chmod_command.rs index 41f87ba750..1fcf52cfd8 100644 --- a/cli/tests/test_file_chmod_command.rs +++ b/cli/tests/test_file_chmod_command.rs @@ -54,7 +54,7 @@ fn test_chmod_regular_conflict() { create_commit(&test_env, &repo_path, "conflict", &["x", "n"], &[]); // Test the setup - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ conflict ├─╮ │ ○ n @@ -62,15 +62,13 @@ fn test_chmod_regular_conflict() { ├─╯ ○ base ◆ - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]); insta::assert_snapshot!(stdout, - @r###" - file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })])) - "###); + @r#"file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })]))"#); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]); insta::assert_snapshot!(stdout, - @r###" + @r" <<<<<<< Conflict 1 of 1 %%%%%%% Changes from base to side #1 -base @@ -78,18 +76,16 @@ fn test_chmod_regular_conflict() { +++++++ Contents of side #2 n >>>>>>> Conflict 1 of 1 ends - "###); + "); // Test chmodding a conflict test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "x", "file"]); let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]); insta::assert_snapshot!(stdout, - @r###" - file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: true })])) - "###); + @r#"file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: true })]))"#); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]); insta::assert_snapshot!(stdout, - @r###" + @r" <<<<<<< Conflict 1 of 1 %%%%%%% Changes from base to side #1 -base @@ -97,16 +93,14 @@ fn test_chmod_regular_conflict() { +++++++ Contents of side #2 n >>>>>>> Conflict 1 of 1 ends - "###); + "); test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "n", "file"]); let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree"]); insta::assert_snapshot!(stdout, - @r###" - file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })])) - "###); + @r#"file: Ok(Conflicted([Some(File { id: FileId("587be6b4c3f93f93c489c0111bba5596147a26cb"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(File { id: FileId("8ba3a16384aacc37d01564b28401755ce8053f51"), executable: false })]))"#); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file"]); insta::assert_snapshot!(stdout, - @r###" + @r" <<<<<<< Conflict 1 of 1 %%%%%%% Changes from base to side #1 -base @@ -114,12 +108,12 @@ fn test_chmod_regular_conflict() { +++++++ Contents of side #2 n >>>>>>> Conflict 1 of 1 ends - "###); + "); // Unmatched paths should generate warnings let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "chmod", "x", "nonexistent", "file"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No matching entries for paths: nonexistent Working copy now at: yostqsxw 2b11d002 conflict | (conflict) conflict Parent commit : royxmykx 427fbd2f x | x @@ -127,7 +121,7 @@ fn test_chmod_regular_conflict() { Added 0 files, modified 1 files, removed 0 files There are unresolved conflicts at these paths: file 2-sided conflict including an executable - "###); + "); } // TODO: Test demonstrating that conflicts whose *base* is not a file are @@ -160,7 +154,7 @@ fn test_chmod_file_dir_deletion_conflicts() { &["file", "deletion"], &[], ); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ file_deletion ├─╮ │ ○ deletion @@ -172,50 +166,44 @@ fn test_chmod_file_dir_deletion_conflicts() { ├─╯ ○ base ◆ - "###); + "); // The file-dir conflict cannot be chmod-ed let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_dir"]); insta::assert_snapshot!(stdout, - @r###" - file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(Tree(TreeId("133bb38fc4e4bf6b551f1f04db7e48f04cac2877")))])) - "###); + @r#"file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), Some(Tree(TreeId("133bb38fc4e4bf6b551f1f04db7e48f04cac2877")))]))"#); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_dir", "file"]); insta::assert_snapshot!(stdout, - @r###" + @r" Conflict: Removing file with id df967b96a579e45a18b8251732d16804b2e56a55 Adding file with id 78981922613b2afb6025042ff6bd878ac1994e85 Adding tree with id 133bb38fc4e4bf6b551f1f04db7e48f04cac2877 - "###); + "); let stderr = test_env.jj_cmd_failure(&repo_path, &["file", "chmod", "x", "file", "-r=file_dir"]); - insta::assert_snapshot!(stderr, @r###" - Error: Some of the sides of the conflict are not files at 'file'. - "###); + insta::assert_snapshot!(stderr, @"Error: Some of the sides of the conflict are not files at 'file'."); // The file_deletion conflict can be chmod-ed let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_deletion"]); insta::assert_snapshot!(stdout, - @r###" - file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), None])) - "###); + @r#"file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: false }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: false }), None]))"#); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_deletion", "file"]); insta::assert_snapshot!(stdout, - @r###" + @r" <<<<<<< Conflict 1 of 1 +++++++ Contents of side #1 a %%%%%%% Changes from base to side #2 -base >>>>>>> Conflict 1 of 1 ends - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok( &repo_path, &["file", "chmod", "x", "file", "-r=file_deletion"], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: kmkuslsw 139dee15 file_deletion | (conflict) file_deletion Parent commit : zsuskuln c51c9c55 file | file Parent commit : royxmykx 6b18b3c1 deletion | deletion @@ -229,20 +217,18 @@ fn test_chmod_file_dir_deletion_conflicts() { Then use `jj resolve`, or edit the conflict markers in the file directly. Once the conflicts are resolved, you may want to inspect the result with `jj diff`. Then run `jj squash` to move the resolution into the conflicted commit. - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["debug", "tree", "-r=file_deletion"]); insta::assert_snapshot!(stdout, - @r###" - file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), None])) - "###); + @r#"file: Ok(Conflicted([Some(File { id: FileId("78981922613b2afb6025042ff6bd878ac1994e85"), executable: true }), Some(File { id: FileId("df967b96a579e45a18b8251732d16804b2e56a55"), executable: true }), None]))"#); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "-r=file_deletion", "file"]); insta::assert_snapshot!(stdout, - @r###" + @r" <<<<<<< Conflict 1 of 1 +++++++ Contents of side #1 a %%%%%%% Changes from base to side #2 -base >>>>>>> Conflict 1 of 1 ends - "###); + "); } diff --git a/cli/tests/test_file_show_command.rs b/cli/tests/test_file_show_command.rs index 9fd12880a4..db8f26f71d 100644 --- a/cli/tests/test_file_show_command.rs +++ b/cli/tests/test_file_show_command.rs @@ -28,15 +28,11 @@ fn test_show() { // Can print the contents of a file in a commit let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1", "-r", "@-"]); - insta::assert_snapshot!(stdout, @r###" - a - "###); + insta::assert_snapshot!(stdout, @"a"); // Defaults to printing the working-copy version let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); - insta::assert_snapshot!(stdout, @r###" - b - "###); + insta::assert_snapshot!(stdout, @"b"); // Can print a file in a subdirectory let subdir_file = if cfg!(unix) { @@ -45,45 +41,35 @@ fn test_show() { "dir\\file2" }; let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", subdir_file]); - insta::assert_snapshot!(stdout, @r###" - c - "###); + insta::assert_snapshot!(stdout, @"c"); // Error if the path doesn't exist let stderr = test_env.jj_cmd_failure(&repo_path, &["file", "show", "nonexistent"]); - insta::assert_snapshot!(stderr, @r###" - Error: No such path: nonexistent - "###); + insta::assert_snapshot!(stderr, @"Error: No such path: nonexistent"); // Can print files under the specified directory let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir"]); - insta::assert_snapshot!(stdout, @r###" - c - "###); + insta::assert_snapshot!(stdout, @"c"); // Can print multiple files let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "."]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" c b - "###); + "); // Unmatched paths should generate warnings let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "show", "file1", "non-existent"]); - insta::assert_snapshot!(stdout, @r###" - b - "###); - insta::assert_snapshot!(stderr, @r###" - Warning: No matching entries for paths: non-existent - "###); + insta::assert_snapshot!(stdout, @"b"); + insta::assert_snapshot!(stderr, @"Warning: No matching entries for paths: non-existent"); // Can print a conflict test_env.jj_cmd_ok(&repo_path, &["new"]); std::fs::write(repo_path.join("file1"), "c\n").unwrap(); test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "@", "-d", "@--"]); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" <<<<<<< Conflict 1 of 1 %%%%%%% Changes from base to side #1 -b @@ -91,7 +77,7 @@ fn test_show() { +++++++ Contents of side #2 c >>>>>>> Conflict 1 of 1 ends - "###); + "); } #[cfg(unix)] @@ -108,11 +94,9 @@ fn test_show_symlink() { // Can print multiple files let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "show", "."]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" c a - "###); - insta::assert_snapshot!(stderr, @r###" - Warning: Path 'symlink1' exists but is not a file - "###); + "); + insta::assert_snapshot!(stderr, @"Warning: Path 'symlink1' exists but is not a file"); } diff --git a/cli/tests/test_file_track_untrack_commands.rs b/cli/tests/test_file_track_untrack_commands.rs index 2d6d2bef0f..40a52c6431 100644 --- a/cli/tests/test_file_track_untrack_commands.rs +++ b/cli/tests/test_file_track_untrack_commands.rs @@ -40,27 +40,27 @@ fn test_track_untrack() { // Errors out when not run at the head operation let stderr = test_env.jj_cmd_failure(&repo_path, &["file", "untrack", "file1", "--at-op", "@-"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: This command must be able to update the working copy. Hint: Don't use --at-op. - "###); + "); // Errors out when no path is specified let stderr = test_env.jj_cmd_cli_error(&repo_path, &["file", "untrack"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: the following required arguments were not provided: ... Usage: jj file untrack ... For more information, try '--help'. - "###); + "); // Errors out when a specified file is not ignored let stderr = test_env.jj_cmd_failure(&repo_path, &["file", "untrack", "file1", "file1.bak"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: 'file1' is not ignored. Hint: Files that are not ignored will be added back by the next command. Make sure they're ignored, then try again. - "###); + "); let files_after = test_env.jj_cmd_success(&repo_path, &["file", "list"]); // There should be no changes to the state when there was an error assert_eq!(files_after, files_before); @@ -69,10 +69,10 @@ fn test_track_untrack() { assert!(files_before.contains("file1.bak\n")); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["untrack", "file1.bak"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: `jj untrack` is deprecated; use `jj file untrack` instead, which is equivalent Warning: `jj untrack` will be removed in a future version, and this will be a hard error - "###); + "); let files_after = test_env.jj_cmd_success(&repo_path, &["file", "list"]); // The file is no longer tracked assert!(!files_after.contains("file1.bak")); @@ -116,27 +116,23 @@ fn test_track_untrack_sparse() { // doesn't need to be ignored (because it won't be automatically added // back). let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file1 file2 - "###); + "); test_env.jj_cmd_ok(&repo_path, &["sparse", "set", "--clear", "--add", "file1"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "untrack", "file2"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); - insta::assert_snapshot!(stdout, @r###" - file1 - "###); + insta::assert_snapshot!(stdout, @"file1"); // Trying to manually track a file that's not included in the sparse working has // no effect. TODO: At least a warning would be useful let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["file", "track", "file2"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); - insta::assert_snapshot!(stdout, @r###" - file1 - "###); + insta::assert_snapshot!(stdout, @"file1"); } #[test] @@ -152,44 +148,38 @@ fn test_auto_track() { // Only configured paths get auto-tracked let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); - insta::assert_snapshot!(stdout, @r###" - file1.rs - "###); + insta::assert_snapshot!(stdout, @"file1.rs"); // Can manually track paths let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file3.md"]); insta::assert_snapshot!(stdout, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" file1.rs file3.md - "###); + "); // Can manually untrack paths let stdout = test_env.jj_cmd_success(&repo_path, &["file", "untrack", "file3.md"]); insta::assert_snapshot!(stdout, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); - insta::assert_snapshot!(stdout, @r###" - file1.rs - "###); + insta::assert_snapshot!(stdout, @"file1.rs"); // CWD-relative paths in `snapshot.auto-track` are evaluated from the repo root let subdir = repo_path.join("sub"); std::fs::create_dir(&subdir).unwrap(); std::fs::write(subdir.join("file1.rs"), "initial").unwrap(); let stdout = test_env.jj_cmd_success(&subdir, &["file", "list"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" - ../file1.rs - "###); + insta::assert_snapshot!(stdout.replace('\\', "/"), @"../file1.rs"); // But `jj file track` wants CWD-relative paths let stdout = test_env.jj_cmd_success(&subdir, &["file", "track", "file1.rs"]); insta::assert_snapshot!(stdout, @""); let stdout = test_env.jj_cmd_success(&subdir, &["file", "list"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" + insta::assert_snapshot!(stdout.replace('\\', "/"), @r" ../file1.rs file1.rs - "###); + "); } #[test] @@ -207,16 +197,12 @@ fn test_track_ignored() { let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file1"]); insta::assert_snapshot!(stdout, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); - insta::assert_snapshot!(stdout, @r###" - file1 - "###); + insta::assert_snapshot!(stdout, @"file1"); // Track an ignored path let stdout = test_env.jj_cmd_success(&repo_path, &["file", "track", "file1.bak"]); insta::assert_snapshot!(stdout, @""); // TODO: We should teach `jj file track` to track ignored paths (possibly // requiring a flag) let stdout = test_env.jj_cmd_success(&repo_path, &["file", "list"]); - insta::assert_snapshot!(stdout, @r###" - file1 - "###); + insta::assert_snapshot!(stdout, @"file1"); } diff --git a/cli/tests/test_fix_command.rs b/cli/tests/test_fix_command.rs index a8a99f7171..9d0853c2a6 100644 --- a/cli/tests/test_fix_command.rs +++ b/cli/tests/test_fix_command.rs @@ -60,7 +60,7 @@ fn test_config_no_tools() { "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); - insta::assert_snapshot!(content, @"content\n"); + insta::assert_snapshot!(content, @"content"); } #[test] @@ -90,11 +90,11 @@ fn test_config_multiple_tools() { let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); - insta::assert_snapshot!(content, @"FOO\n"); + insta::assert_snapshot!(content, @"FOO"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]); - insta::assert_snapshot!(content, @"bar\n"); + insta::assert_snapshot!(content, @"bar"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]); - insta::assert_snapshot!(content, @"Baz\n"); + insta::assert_snapshot!(content, @"Baz"); } #[test] @@ -139,9 +139,9 @@ fn test_config_multiple_tools_with_same_name() { test_env.set_config_path("/dev/null"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); - insta::assert_snapshot!(content, @"Foo\n"); + insta::assert_snapshot!(content, @"Foo"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]); - insta::assert_snapshot!(content, @"Bar\n"); + insta::assert_snapshot!(content, @"Bar"); } #[test] @@ -178,11 +178,11 @@ fn test_config_disabled_tools() { let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); - insta::assert_snapshot!(content, @"FOO\n"); + insta::assert_snapshot!(content, @"FOO"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]); - insta::assert_snapshot!(content, @"bar\n"); + insta::assert_snapshot!(content, @"bar"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]); - insta::assert_snapshot!(content, @"Baz\n"); + insta::assert_snapshot!(content, @"Baz"); } #[test] @@ -205,10 +205,10 @@ fn test_config_disabled_tools_warning_when_all_tools_are_disabled() { std::fs::write(repo_path.join("bar"), "Bar\n").unwrap(); let stderr = test_env.jj_cmd_failure(&repo_path, &["fix"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Config error: At least one entry of `fix.tools` must be enabled. For help, see https://jj-vcs.github.io/jj/latest/config/. - "###); + "); } #[test] @@ -239,21 +239,21 @@ fn test_config_tables_overlapping_patterns() { let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" foo tool-1 - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "bar", "-r", "@"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" bar tool-1 tool-2 - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "baz", "-r", "@"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" baz tool-2 - "###); + "); } #[test] @@ -283,7 +283,7 @@ fn test_config_tables_all_commands_missing() { "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); - insta::assert_snapshot!(content, @"foo\n"); + insta::assert_snapshot!(content, @"foo"); } #[test] @@ -317,7 +317,7 @@ fn test_config_tables_some_commands_missing() { "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); - insta::assert_snapshot!(content, @"foo\n"); + insta::assert_snapshot!(content, @"foo"); } #[test] @@ -340,13 +340,13 @@ fn test_config_tables_empty_patterns_list() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Fixed 0 commits of 1 checked. - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @r" + Fixed 0 commits of 1 checked. + Nothing changed. + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo", "-r", "@"]); - insta::assert_snapshot!(content, @"foo\n"); + insta::assert_snapshot!(content, @"foo"); } #[test] @@ -380,11 +380,11 @@ fn test_config_filesets() { let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a1", "-r", "@"]); - insta::assert_snapshot!(content, @"A1\n"); + insta::assert_snapshot!(content, @"A1"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b1", "-r", "@"]); - insta::assert_snapshot!(content, @"1b\n"); + insta::assert_snapshot!(content, @"1b"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b2", "-r", "@"]); - insta::assert_snapshot!(content, @"2b\n"); + insta::assert_snapshot!(content, @"2b"); } #[test] @@ -413,30 +413,30 @@ fn test_relative_paths() { // filesets. let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix", "foo3"]); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo1", "-r", "@"]); - insta::assert_snapshot!(content, @"unfixed\n"); + insta::assert_snapshot!(content, @"unfixed"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]); - insta::assert_snapshot!(content, @"unfixed\n"); + insta::assert_snapshot!(content, @"unfixed"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]); - insta::assert_snapshot!(content, @"unfixed\n"); + insta::assert_snapshot!(content, @"unfixed"); // Positional arguments can specify a subset of the configured fileset. let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix", "../foo1"]); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo1", "-r", "@"]); - insta::assert_snapshot!(content, @"Fixed!\n"); + insta::assert_snapshot!(content, @"Fixed!"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]); - insta::assert_snapshot!(content, @"unfixed\n"); + insta::assert_snapshot!(content, @"unfixed"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]); - insta::assert_snapshot!(content, @"unfixed\n"); + insta::assert_snapshot!(content, @"unfixed"); // The current directory does not change the interpretation of the config, so // foo2 is fixed but not dir/foo3. let (_stdout, _stderr) = test_env.jj_cmd_ok(&repo_path.join("dir"), &["fix"]); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo1", "-r", "@"]); - insta::assert_snapshot!(content, @"Fixed!\n"); + insta::assert_snapshot!(content, @"Fixed!"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "foo2", "-r", "@"]); - insta::assert_snapshot!(content, @"Fixed!\n"); + insta::assert_snapshot!(content, @"Fixed!"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "dir/foo3", "-r", "@"]); - insta::assert_snapshot!(content, @"unfixed\n"); + insta::assert_snapshot!(content, @"unfixed"); } #[test] @@ -647,9 +647,7 @@ fn test_fix_some_paths() { Added 0 files, modified 1 files, removed 0 files "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file1"]); - insta::assert_snapshot!(content, @r###" - FOO - "###); + insta::assert_snapshot!(content, @"FOO"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file2"]); insta::assert_snapshot!(content, @"bar"); } @@ -668,7 +666,7 @@ fn test_fix_cyclic() { Added 0 files, modified 1 files, removed 0 files "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); - insta::assert_snapshot!(content, @"tnetnoc\n"); + insta::assert_snapshot!(content, @"tnetnoc"); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["fix"]); insta::assert_snapshot!(stdout, @""); @@ -679,7 +677,7 @@ fn test_fix_cyclic() { Added 0 files, modified 1 files, removed 0 files "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); - insta::assert_snapshot!(content, @"content\n"); + insta::assert_snapshot!(content, @"content"); } #[test] @@ -712,18 +710,21 @@ fn test_deduplication() { Added 0 files, modified 1 files, removed 0 files "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "a"]); - insta::assert_snapshot!(content, @"FOO\n"); + insta::assert_snapshot!(content, @"FOO"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "b"]); - insta::assert_snapshot!(content, @"BAR\n"); + insta::assert_snapshot!(content, @"BAR"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "c"]); - insta::assert_snapshot!(content, @"BAR\n"); + insta::assert_snapshot!(content, @"BAR"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "d"]); - insta::assert_snapshot!(content, @"FOO\n"); + insta::assert_snapshot!(content, @"FOO"); // Each new content string only appears once in the log, because all the other // inputs (like file name) were identical, and so the results were reused. We // sort the log because the order of execution inside `jj fix` is undefined. - insta::assert_snapshot!(sorted_lines(repo_path.join("file-fixlog")), @"BAR\nFOO\n"); + insta::assert_snapshot!(sorted_lines(repo_path.join("file-fixlog")), @r" + BAR + FOO + "); } fn sorted_lines(path: PathBuf) -> String { @@ -750,9 +751,9 @@ fn test_executed_but_nothing_changed() { Nothing changed. "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); - insta::assert_snapshot!(content, @"content\n"); + insta::assert_snapshot!(content, @"content"); let copy_content = std::fs::read_to_string(repo_path.join("file-copy").as_os_str()).unwrap(); - insta::assert_snapshot!(copy_content, @"content\n"); + insta::assert_snapshot!(copy_content, @"content"); } #[test] @@ -959,22 +960,18 @@ fn test_fix_both_sides_of_conflict() { file 2-sided conflict "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "a"]); - insta::assert_snapshot!(content, @r###" - CONTENT A - "###); + insta::assert_snapshot!(content, @"CONTENT A"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "b"]); - insta::assert_snapshot!(content, @r###" - CONTENT B - "###); + insta::assert_snapshot!(content, @"CONTENT B"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" <<<<<<< Conflict 1 of 1 %%%%%%% Changes from base to side #1 +CONTENT A +++++++ Contents of side #2 CONTENT B >>>>>>> Conflict 1 of 1 ends - "###); + "); } #[test] @@ -1001,9 +998,7 @@ fn test_fix_resolve_conflict() { Added 0 files, modified 1 files, removed 0 files "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "file", "-r", "@"]); - insta::assert_snapshot!(content, @r###" - CONTENT - "###); + insta::assert_snapshot!(content, @"CONTENT"); } #[test] @@ -1058,96 +1053,76 @@ fn test_all_files() { ], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Fixed 2 commits of 2 checked. Working copy now at: rlvkpnrz c098d165 child Parent commit : qpvuntsm 0bb31627 parent Added 0 files, modified 1 files, removed 0 files - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@-"]); - insta::assert_snapshot!(content, @r###" - parent aaa - "###); + insta::assert_snapshot!(content, @"parent aaa"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@-"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" parent bbb fixed - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@-"]); - insta::assert_snapshot!(content, @r###" - parent ccc - "###); + insta::assert_snapshot!(content, @"parent ccc"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@-"]); - insta::assert_snapshot!(content, @r###" - parent ddd - "###); + insta::assert_snapshot!(content, @"parent ddd"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@"]); - insta::assert_snapshot!(content, @r###" - child aaa - "###); + insta::assert_snapshot!(content, @"child aaa"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" parent bbb fixed - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@"]); - insta::assert_snapshot!(content, @r###" - parent ccc - "###); + insta::assert_snapshot!(content, @"parent ccc"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@"]); - insta::assert_snapshot!(content, @r###" - child ddd - "###); + insta::assert_snapshot!(content, @"child ddd"); // Not specifying files means all files will be fixed in each revision. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["fix", "--include-unchanged-files"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Fixed 2 commits of 2 checked. Working copy now at: rlvkpnrz c5d0aa1d child Parent commit : qpvuntsm b4d02ca9 parent Added 0 files, modified 2 files, removed 0 files - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@-"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" parent aaa fixed - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@-"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" parent bbb fixed fixed - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@-"]); - insta::assert_snapshot!(content, @r###" - parent ccc - "###); + insta::assert_snapshot!(content, @"parent ccc"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@-"]); - insta::assert_snapshot!(content, @r###" - parent ddd - "###); + insta::assert_snapshot!(content, @"parent ddd"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "a/a", "-r", "@"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" child aaa fixed - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "b/b", "-r", "@"]); - insta::assert_snapshot!(content, @r###" + insta::assert_snapshot!(content, @r" parent bbb fixed fixed - "###); + "); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "c/c", "-r", "@"]); - insta::assert_snapshot!(content, @r###" - parent ccc - "###); + insta::assert_snapshot!(content, @"parent ccc"); let content = test_env.jj_cmd_success(&repo_path, &["file", "show", "ddd", "-r", "@"]); - insta::assert_snapshot!(content, @r###" - child ddd - "###); + insta::assert_snapshot!(content, @"child ddd"); } diff --git a/cli/tests/test_git_clone.rs b/cli/tests/test_git_clone.rs index c0e5bb6081..53ea728030 100644 --- a/cli/tests/test_git_clone.rs +++ b/cli/tests/test_git_clone.rs @@ -68,10 +68,10 @@ fn test_git_clone(subprocess: bool) { test_env.jj_cmd_ok(test_env.env_root(), &["git", "clone", "source", "empty"]); insta::allow_duplicates! { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Fetching into new repo in "$TEST_ENV/empty" Nothing changed. - "###); + "#); } set_up_non_empty_git_repo(&git_repo); @@ -101,9 +101,7 @@ fn test_git_clone(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); } // Failed clone should clean up the destination directory @@ -160,36 +158,28 @@ fn test_git_clone(subprocess: bool) { // Failed clone (if attempted) shouldn't remove the existing workspace let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["git", "clone", "bad", "clone"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Destination path exists and is not an empty directory - "###); + insta::assert_snapshot!(stderr, @"Error: Destination path exists and is not an empty directory"); } assert!(test_env.env_root().join("clone").join(".jj").exists()); // Try cloning into an existing workspace let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["git", "clone", "source", "clone"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Destination path exists and is not an empty directory - "###); + insta::assert_snapshot!(stderr, @"Error: Destination path exists and is not an empty directory"); } // Try cloning into an existing file std::fs::write(test_env.env_root().join("file"), "contents").unwrap(); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["git", "clone", "source", "file"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Destination path exists and is not an empty directory - "###); + insta::assert_snapshot!(stderr, @"Error: Destination path exists and is not an empty directory"); } // Try cloning into non-empty, non-workspace directory std::fs::remove_dir_all(test_env.env_root().join("clone").join(".jj")).unwrap(); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["git", "clone", "source", "clone"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Destination path exists and is not an empty directory - "###); + insta::assert_snapshot!(stderr, @"Error: Destination path exists and is not an empty directory"); } // Clone into a nested path @@ -258,10 +248,10 @@ 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/empty" Nothing changed. - "###); + "#); } // git_target path should be relative to the store @@ -324,21 +314,21 @@ fn test_git_clone_colocate(subprocess: bool) { .map(|entry| format!("{:?} {}\n", entry.status(), entry.path().unwrap())) .collect(); insta::allow_duplicates! { - insta::assert_snapshot!(git_statuses, @r###" + insta::assert_snapshot!(git_statuses, @r" Status(IGNORED) .jj/.gitignore Status(IGNORED) .jj/repo/ Status(IGNORED) .jj/working_copy/ - "###); + "); } // The old default bookmark "master" shouldn't exist. insta::allow_duplicates! { insta::assert_snapshot!( - get_bookmark_output(&test_env, &test_env.env_root().join("clone")), @r###" + get_bookmark_output(&test_env, &test_env.env_root().join("clone")), @r" main: mzyxwzks 9f01a0e0 message @git: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message - "###); + "); } // Subsequent fetch should just work even if the source path was relative @@ -348,9 +338,7 @@ fn test_git_clone_colocate(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); } // Failed clone should clean up the destination directory @@ -417,9 +405,7 @@ fn test_git_clone_colocate(subprocess: bool) { &["git", "clone", "--colocate", "bad", "clone"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Destination path exists and is not an empty directory - "###); + insta::assert_snapshot!(stderr, @"Error: Destination path exists and is not an empty directory"); } assert!(test_env.env_root().join("clone").join(".git").exists()); assert!(test_env.env_root().join("clone").join(".jj").exists()); @@ -430,9 +416,7 @@ fn test_git_clone_colocate(subprocess: bool) { &["git", "clone", "source", "clone", "--colocate"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Destination path exists and is not an empty directory - "###); + insta::assert_snapshot!(stderr, @"Error: Destination path exists and is not an empty directory"); } // Try cloning into an existing file @@ -442,9 +426,7 @@ fn test_git_clone_colocate(subprocess: bool) { &["git", "clone", "source", "file", "--colocate"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Destination path exists and is not an empty directory - "###); + insta::assert_snapshot!(stderr, @"Error: Destination path exists and is not an empty directory"); } // Try cloning into non-empty, non-workspace directory @@ -454,9 +436,7 @@ fn test_git_clone_colocate(subprocess: bool) { &["git", "clone", "source", "clone", "--colocate"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: Destination path exists and is not an empty directory - "###); + insta::assert_snapshot!(stderr, @"Error: Destination path exists and is not an empty directory"); } // Clone into a nested path @@ -522,12 +502,12 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) { } insta::allow_duplicates! { insta::assert_snapshot!( - get_bookmark_output(&test_env, &test_env.env_root().join("clone1")), @r###" + get_bookmark_output(&test_env, &test_env.env_root().join("clone1")), @r" feature1: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message main: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message - "###); + "); } // "trunk()" alias should be set to default bookmark "main" @@ -536,9 +516,7 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) { &["config", "list", "--repo", "revset-aliases.'trunk()'"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r###" - revset-aliases.'trunk()' = "main@origin" - "###); + insta::assert_snapshot!(stdout, @r#"revset-aliases.'trunk()' = "main@origin""#); } // Only the default bookmark will be imported if auto-local-bookmark is off @@ -558,11 +536,11 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) { } insta::allow_duplicates! { insta::assert_snapshot!( - get_bookmark_output(&test_env, &test_env.env_root().join("clone2")), @r###" + get_bookmark_output(&test_env, &test_env.env_root().join("clone2")), @r" feature1@origin: mzyxwzks 9f01a0e0 message main: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message - "###); + "); } // Change the default bookmark in remote @@ -595,9 +573,7 @@ fn test_git_clone_remote_default_bookmark(subprocess: bool) { &["config", "list", "--repo", "revset-aliases.'trunk()'"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r###" - revset-aliases.'trunk()' = "feature1@origin" - "###); + insta::assert_snapshot!(stdout, @r#"revset-aliases.'trunk()' = "feature1@origin""#); } } @@ -671,11 +647,11 @@ fn test_git_clone_ignore_working_copy(subprocess: bool) { let (stdout, stderr) = test_env.jj_cmd_ok(&clone_path, &["status", "--ignore-working-copy"]); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" The working copy is clean Working copy : sqpuoqvx cad212e1 (empty) (no description set) Parent commit: mzyxwzks 9f01a0e0 main | message - "###); + "); } insta::allow_duplicates! { insta::assert_snapshot!(stderr, @""); @@ -684,11 +660,11 @@ fn test_git_clone_ignore_working_copy(subprocess: bool) { // TODO: Correct, but might be better to check out the root commit? let stderr = test_env.jj_cmd_failure(&clone_path, &["status"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r##" + insta::assert_snapshot!(stderr, @r" Error: The working copy is stale (not updated since operation eac759b9ab75). Hint: Run `jj workspace update-stale` to update it. See https://jj-vcs.github.io/jj/latest/working-copy/#stale-working-copy for more information. - "##); + "); } } @@ -708,9 +684,7 @@ fn test_git_clone_at_operation(subprocess: bool) { &["git", "clone", "--at-op=@-", "source", "clone"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: --at-op is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --at-op is not respected"); } } @@ -807,13 +781,13 @@ fn test_git_clone_trunk_deleted(subprocess: bool) { let (stdout, stderr) = test_env.jj_cmd_ok(&clone_path, &["log"]); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ sqpuoqvx test.user@example.com 2001-02-03 08:05:07 cad212e1 │ (empty) (no description set) ○ mzyxwzks some.one@example.com 1970-01-01 11:00:00 9f01a0e0 │ message ◆ zzzzzzzz root() 00000000 - "#); + "); } insta::allow_duplicates! { insta::assert_snapshot!(stderr, @r" @@ -1023,21 +997,21 @@ fn test_git_clone_malformed(subprocess: bool) { // The cloned workspace isn't usable. let stderr = test_env.jj_cmd_failure(&clone_path, &["status"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r##" + insta::assert_snapshot!(stderr, @r" Error: The working copy is stale (not updated since operation 4a8ddda0ff63). Hint: Run `jj workspace update-stale` to update it. See https://jj-vcs.github.io/jj/latest/working-copy/#stale-working-copy for more information. - "##); + "); } // The error can be somehow recovered. // TODO: add an update-stale flag to reset the working-copy? let stderr = test_env.jj_cmd_internal_error(&clone_path, &["workspace", "update-stale"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Internal error: Failed to check out commit 039a1eae03465fd3be0fbad87c9ca97303742677 Caused by: Reserved path component .jj in $TEST_ENV/clone/.jj - "#); + "); } let (_stdout, stderr) = test_env.jj_cmd_ok(&clone_path, &["new", "root()", "--ignore-working-copy"]); @@ -1046,11 +1020,11 @@ fn test_git_clone_malformed(subprocess: bool) { } let stdout = test_env.jj_cmd_success(&clone_path, &["status"]); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" The working copy is clean Working copy : zsuskuln f652c321 (empty) (no description set) Parent commit: zzzzzzzz 00000000 (empty) (no description set) - "#); + "); } } diff --git a/cli/tests/test_git_colocated.rs b/cli/tests/test_git_colocated.rs index cadff9e35b..4a66a11034 100644 --- a/cli/tests/test_git_colocated.rs +++ b/cli/tests/test_git_colocated.rs @@ -57,11 +57,11 @@ fn test_git_colocated() { // Import the repo test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 3e9369cd54227eb88455e1834dbc08aad6a16ac4 ○ e61b6729ff4292870702f2f72b2a60165679ef37 master git_head() initial ◆ 0000000000000000000000000000000000000000 - "#); + "); insta::assert_snapshot!( git_repo.head().unwrap().peel_to_commit().unwrap().id().to_string(), @"e61b6729ff4292870702f2f72b2a60165679ef37" @@ -70,11 +70,11 @@ fn test_git_colocated() { // Modify the working copy. The working-copy commit should changed, but the Git // HEAD commit should not std::fs::write(workspace_root.join("file"), "modified").unwrap(); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 4f546c80f30abc0803fb83e5032a4d49fede4d68 ○ e61b6729ff4292870702f2f72b2a60165679ef37 master git_head() initial ◆ 0000000000000000000000000000000000000000 - "#); + "); insta::assert_snapshot!( git_repo.head().unwrap().peel_to_commit().unwrap().id().to_string(), @"e61b6729ff4292870702f2f72b2a60165679ef37" @@ -82,12 +82,12 @@ fn test_git_colocated() { // Create a new change from jj and check that it's reflected in Git test_env.jj_cmd_ok(&workspace_root, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 0e2301a42b288b9568344e32cfdd8c76d1e56a83 ○ 4f546c80f30abc0803fb83e5032a4d49fede4d68 git_head() ○ e61b6729ff4292870702f2f72b2a60165679ef37 master initial ◆ 0000000000000000000000000000000000000000 - "#); + "); insta::assert_snapshot!( git_repo.head().unwrap().target().unwrap().to_string(), @"4f546c80f30abc0803fb83e5032a4d49fede4d68" @@ -119,67 +119,67 @@ fn test_git_colocated_unborn_bookmark() { git_repo.find_reference("HEAD").unwrap().symbolic_target(), Some("refs/heads/master") ); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Stage some change, and check out root. This shouldn't clobber the HEAD. add_file_to_index("file0", ""); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["new", "root()"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: kkmpptxz fcdbbd73 (empty) (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set) Added 0 files, modified 0 files, removed 1 files - "###); + "); assert!(git_repo.head().is_err()); assert_eq!( git_repo.find_reference("HEAD").unwrap().symbolic_target(), Some("refs/heads/master") ); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ fcdbbd731496cae17161cd6be9b6cf1f759655a8 │ ○ 993600f1189571af5bbeb492cf657dc7d0fde48a ├─╯ ◆ 0000000000000000000000000000000000000000 - "###); + "); // Staged change shouldn't persist. checkout_index(); - insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r" The working copy is clean Working copy : kkmpptxz fcdbbd73 (empty) (no description set) Parent commit: zzzzzzzz 00000000 (empty) (no description set) - "###); + "); // Stage some change, and create new HEAD. This shouldn't move the default // bookmark. add_file_to_index("file1", ""); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["new"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: royxmykx 0e146103 (empty) (no description set) Parent commit : kkmpptxz e3e01407 (no description set) - "###); + "); assert!(git_repo.head().unwrap().symbolic_target().is_none()); insta::assert_snapshot!( git_repo.head().unwrap().peel_to_commit().unwrap().id().to_string(), @"e3e01407bd3539722ae4ffff077700d97c60cb11" ); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 0e14610343ef50775f5c44db5aeef19aee45d9ad ○ e3e01407bd3539722ae4ffff077700d97c60cb11 git_head() │ ○ 993600f1189571af5bbeb492cf657dc7d0fde48a ├─╯ ◆ 0000000000000000000000000000000000000000 - "#); + "); // Staged change shouldn't persist. checkout_index(); - insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r" The working copy is clean Working copy : royxmykx 0e146103 (empty) (no description set) Parent commit: kkmpptxz e3e01407 (no description set) - "###); + "); // Assign the default bookmark. The bookmark is no longer "unborn". test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "-r@-", "master"]); @@ -189,13 +189,13 @@ fn test_git_colocated_unborn_bookmark() { add_file_to_index("file2", ""); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["new", "root()"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: znkkpsqq 10dd328b (empty) (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set) Added 0 files, modified 0 files, removed 2 files - "###); + "); assert!(git_repo.head().is_err()); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 10dd328bb906e15890e55047740eab2812a3b2f7 │ ○ ef75c0b0dcc9b080e00226908c21316acaa84dc6 │ ○ e3e01407bd3539722ae4ffff077700d97c60cb11 master @@ -203,24 +203,24 @@ fn test_git_colocated_unborn_bookmark() { │ ○ 993600f1189571af5bbeb492cf657dc7d0fde48a ├─╯ ◆ 0000000000000000000000000000000000000000 - "###); + "); // Staged change shouldn't persist. checkout_index(); - insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&workspace_root, &["status"]), @r" The working copy is clean Working copy : znkkpsqq 10dd328b (empty) (no description set) Parent commit: zzzzzzzz 00000000 (empty) (no description set) - "###); + "); // New snapshot and commit can be created after the HEAD got unset. std::fs::write(workspace_root.join("file3"), "").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["new"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: wqnwkozp 101e2723 (empty) (no description set) Parent commit : znkkpsqq fc8af934 (no description set) - "###); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 101e272377a9daff75358f10dbd078df922fe68c ○ fc8af9345b0830dcb14716e04cd2af26e2d19f63 git_head() │ ○ ef75c0b0dcc9b080e00226908c21316acaa84dc6 @@ -229,7 +229,7 @@ fn test_git_colocated_unborn_bookmark() { │ ○ 993600f1189571af5bbeb492cf657dc7d0fde48a ├─╯ ◆ 0000000000000000000000000000000000000000 - "#); + "); } #[test] @@ -245,18 +245,18 @@ fn test_git_colocated_export_bookmarks_on_snapshot() { // Create bookmark pointing to the initial commit std::fs::write(workspace_root.join("file"), "initial").unwrap(); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "foo"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ b15ef4cdd277d2c63cce6d67c1916f53a36141f7 foo ◆ 0000000000000000000000000000000000000000 - "###); + "); // The bookmark gets updated when we modify the working copy, and it should get // exported to Git without requiring any other changes std::fs::write(workspace_root.join("file"), "modified").unwrap(); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 4d2c49a8f8e2f1ba61f48ba79e5f4a5faa6512cf foo ◆ 0000000000000000000000000000000000000000 - "###); + "); insta::assert_snapshot!(git_repo .find_reference("refs/heads/foo") .unwrap() @@ -294,19 +294,19 @@ fn test_git_colocated_rebase_on_import() { let commit1 = commit2.parents().next().unwrap(); git_repo.branch("master", &commit1, true).unwrap(); let (stdout, stderr) = get_log_output_with_stderr(&test_env, &workspace_root); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ 15b1d70c5e33b5d2b18383292b85324d5153ffed ○ 47fe984daf66f7bf3ebf31b9cb3513c995afb857 master git_head() add a file ◆ 0000000000000000000000000000000000000000 - "#); - insta::assert_snapshot!(stderr, @r###" + "); + insta::assert_snapshot!(stderr, @r" Abandoned 1 commits that are no longer reachable. Rebased 1 descendant commits off of commits rewritten from git Working copy now at: zsuskuln 15b1d70c (empty) (no description set) Parent commit : qpvuntsm 47fe984d master | add a file Added 0 files, modified 1 files, removed 0 files Done importing changes from the underlying Git repo. - "###); + "); } #[test] @@ -317,13 +317,13 @@ fn test_git_colocated_bookmarks() { test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); test_env.jj_cmd_ok(&workspace_root, &["new", "-m", "foo"]); test_env.jj_cmd_ok(&workspace_root, &["new", "@-", "-m", "bar"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 3560559274ab431feea00b7b7e0b9250ecce951f bar │ ○ 1e6f0b403ed2ff9713b5d6b1dc601e4804250cda foo ├─╯ ○ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 git_head() ◆ 0000000000000000000000000000000000000000 - "#); + "); // Create a bookmark in jj. It should be exported to Git even though it points // to the working- copy commit. @@ -351,19 +351,19 @@ fn test_git_colocated_bookmarks() { ) .unwrap(); let (stdout, stderr) = get_log_output_with_stderr(&test_env, &workspace_root); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ 096dc80da67094fbaa6683e2a205dddffa31f9a8 │ ○ 1e6f0b403ed2ff9713b5d6b1dc601e4804250cda master foo ├─╯ ○ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 git_head() ◆ 0000000000000000000000000000000000000000 - "#); - insta::assert_snapshot!(stderr, @r###" + "); + insta::assert_snapshot!(stderr, @r" Abandoned 1 commits that are no longer reachable. Working copy now at: yqosqzyt 096dc80d (empty) (no description set) Parent commit : qpvuntsm 230dd059 (empty) (no description set) Done importing changes from the underlying Git repo. - "###); + "); } #[test] @@ -374,21 +374,19 @@ fn test_git_colocated_bookmark_forget() { test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); test_env.jj_cmd_ok(&workspace_root, &["new"]); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "foo"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 65b6b74e08973b88d38404430f119c8c79465250 foo ○ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 git_head() ◆ 0000000000000000000000000000000000000000 - "#); - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + "); + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" foo: rlvkpnrz 65b6b74e (empty) (no description set) @git: rlvkpnrz 65b6b74e (empty) (no description set) - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["bookmark", "forget", "foo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Forgot 1 bookmarks. - "###); + insta::assert_snapshot!(stderr, @"Forgot 1 bookmarks."); // A forgotten bookmark is deleted in the git repo. For a detailed demo // explaining this, see `test_bookmark_forget_export` in // `test_bookmark_command.rs`. @@ -403,16 +401,14 @@ fn test_git_colocated_bookmark_at_root() { let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "foo", "-r=root()"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Created 1 bookmarks pointing to zzzzzzzz 00000000 foo | (empty) (no description set) Warning: Failed to export some bookmarks: foo: Ref cannot point to the root commit in Git - "###); + "); let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "move", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Moved 1 bookmarks to qpvuntsm 230dd059 foo | (empty) (no description set) - "###); + insta::assert_snapshot!(stderr, @"Moved 1 bookmarks to qpvuntsm 230dd059 foo | (empty) (no description set)"); let (_stdout, stderr) = test_env.jj_cmd_ok( &repo_path, @@ -424,11 +420,11 @@ fn test_git_colocated_bookmark_at_root() { "--to=root()", ], ); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Moved 1 bookmarks to zzzzzzzz 00000000 foo* | (empty) (no description set) Warning: Failed to export some bookmarks: foo: Ref cannot point to the root commit in Git - "###); + "); } #[test] @@ -441,14 +437,14 @@ fn test_git_colocated_conflicting_git_refs() { let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "main/sub"]); insta::assert_snapshot!(stdout, @""); insta::with_settings!({filters => vec![("Failed to set: .*", "Failed to set: ...")]}, { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Created 1 bookmarks pointing to qpvuntsm 230dd059 main main/sub | (empty) (no description set) Warning: Failed to export some bookmarks: main/sub: Failed to set: ... Hint: Git doesn't allow a branch name that looks like a parent directory of another (e.g. `foo` and `foo/bar`). Try to rename the bookmarks that failed to export or their "parent" bookmarks. - "###); + "#); }); } @@ -495,23 +491,23 @@ fn test_git_colocated_checkout_non_empty_working_copy() { test_env.jj_cmd_ok(&workspace_root, &["describe", "-m", "two"]); test_env.jj_cmd_ok(&workspace_root, &["new", "@-"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["describe", "-m", "new"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: kkmpptxz 149cc31c (empty) new Parent commit : lnksqltp e61b6729 master | initial - "###); + "); let git_head = git_repo.find_reference("HEAD").unwrap(); let git_head_target = git_head.symbolic_target().unwrap(); assert_eq!(git_head_target, "refs/heads/master"); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 149cc31cb08a1589e6c5ee2cb2061559dc758ecb new │ ○ 4ec6f6506bd1903410f15b80058a7f0d8f62deea two ├─╯ ○ e61b6729ff4292870702f2f72b2a60165679ef37 master git_head() initial ◆ 0000000000000000000000000000000000000000 - "#); + "); } #[test] @@ -532,7 +528,7 @@ fn test_git_colocated_fetch_deleted_or_moved_bookmark() { git2::Repository::clone(origin_path.to_str().unwrap(), &clone_path).unwrap(); test_env.jj_cmd_ok(&clone_path, &["git", "init", "--git-repo=."]); test_env.jj_cmd_ok(&clone_path, &["new", "A"]); - insta::assert_snapshot!(get_log_output(&test_env, &clone_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &clone_path), @r" @ 9c2de797c3c299a40173c5af724329012b77cbdd │ ○ 4a191a9013d3f3398ccf5e172792a61439dbcf3a C_to_move original C ├─╯ @@ -540,27 +536,27 @@ fn test_git_colocated_fetch_deleted_or_moved_bookmark() { ├─╯ ◆ a7e4cec4256b7995129b9d1e1bda7e1df6e60678 A git_head() A ◆ 0000000000000000000000000000000000000000 - "#); + "); test_env.jj_cmd_ok(&origin_path, &["bookmark", "delete", "B_to_delete"]); // Move bookmark C sideways test_env.jj_cmd_ok(&origin_path, &["describe", "C_to_move", "-m", "moved C"]); let (stdout, stderr) = test_env.jj_cmd_ok(&clone_path, &["git", "fetch"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: B_to_delete@origin [deleted] untracked bookmark: C_to_move@origin [updated] tracked Abandoned 2 commits that are no longer reachable. - "###); + "); // "original C" and "B_to_delete" are abandoned, as the corresponding bookmarks // were deleted or moved on the remote (#864) - insta::assert_snapshot!(get_log_output(&test_env, &clone_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &clone_path), @r" @ 9c2de797c3c299a40173c5af724329012b77cbdd │ ○ 4f3d13296f978cbc351c46a43b4619c91b888475 C_to_move moved C ├─╯ ◆ a7e4cec4256b7995129b9d1e1bda7e1df6e60678 A git_head() A ◆ 0000000000000000000000000000000000000000 - "#); + "); } #[test] @@ -586,7 +582,7 @@ fn test_git_colocated_rebase_dirty_working_copy() { // Because the working copy is dirty, the new working-copy commit will be // diverged. Therefore, the feature bookmark has change-delete conflict. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["status"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Working copy changes: M file Working copy : rlvkpnrz 6bad94b1 feature?? | (no description set) @@ -594,17 +590,17 @@ fn test_git_colocated_rebase_dirty_working_copy() { These bookmarks have conflicts: feature Use `jj bookmark list` to see details. Use `jj bookmark set -r ` to resolve. - "###); - insta::assert_snapshot!(stderr, @r###" + "); + insta::assert_snapshot!(stderr, @r" Warning: Failed to export some bookmarks: feature: Modified ref had been deleted in Git Done importing changes from the underlying Git repo. - "###); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + "); + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 6bad94b10401f5fafc8a91064661224650d10d1b feature?? ○ 3230d52258f6de7e9afbd10da8d64503cc7cdca5 git_head() ◆ 0000000000000000000000000000000000000000 - "#); + "); // The working-copy content shouldn't be lost. insta::assert_snapshot!( @@ -629,13 +625,13 @@ fn test_git_colocated_external_checkout() { test_env.jj_cmd_ok(&repo_path, &["new"]); // Checked out anonymous bookmark - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ f8a23336e41840ed1757ef323402a770427dc89a ○ eccedddfa5152d99fc8ddd1081b375387a8a382a git_head() B │ ○ a7e4cec4256b7995129b9d1e1bda7e1df6e60678 master A ├─╯ ◆ 0000000000000000000000000000000000000000 - "#); + "); // Check out another bookmark by external command git_check_out_ref("refs/heads/master"); @@ -643,35 +639,33 @@ fn test_git_colocated_external_checkout() { // The old working-copy commit gets abandoned, but the whole bookmark should not // be abandoned. (#1042) let (stdout, stderr) = get_log_output_with_stderr(&test_env, &repo_path); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ 8bb9e8d42a37c2a4e8dcfad97fce0b8f49bc7afa ○ a7e4cec4256b7995129b9d1e1bda7e1df6e60678 master git_head() A │ ○ eccedddfa5152d99fc8ddd1081b375387a8a382a B ├─╯ ◆ 0000000000000000000000000000000000000000 - "#); - insta::assert_snapshot!(stderr, @r###" - Reset the working copy parent to the new Git HEAD. - "###); + "); + insta::assert_snapshot!(stderr, @"Reset the working copy parent to the new Git HEAD."); // Edit non-head commit test_env.jj_cmd_ok(&repo_path, &["new", "description(B)"]); test_env.jj_cmd_ok(&repo_path, &["new", "-m=C", "--no-edit"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" ○ 99a813753d6db988d8fc436b0d6b30a54d6b2707 C @ 81e086b7f9b1dd7fde252e28bdcf4ba4abd86ce5 ○ eccedddfa5152d99fc8ddd1081b375387a8a382a git_head() B │ ○ a7e4cec4256b7995129b9d1e1bda7e1df6e60678 master A ├─╯ ◆ 0000000000000000000000000000000000000000 - "#); + "); // Check out another bookmark by external command git_check_out_ref("refs/heads/master"); // The old working-copy commit shouldn't be abandoned. (#3747) let (stdout, stderr) = get_log_output_with_stderr(&test_env, &repo_path); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ ca2a4e32f08688c6fb795c4c034a0a7e09c0d804 ○ a7e4cec4256b7995129b9d1e1bda7e1df6e60678 master git_head() A │ ○ 99a813753d6db988d8fc436b0d6b30a54d6b2707 C @@ -679,10 +673,8 @@ fn test_git_colocated_external_checkout() { │ ○ eccedddfa5152d99fc8ddd1081b375387a8a382a B ├─╯ ◆ 0000000000000000000000000000000000000000 - "#); - insta::assert_snapshot!(stderr, @r###" - Reset the working copy parent to the new Git HEAD. - "###); + "); + insta::assert_snapshot!(stderr, @"Reset the working copy parent to the new Git HEAD."); } #[test] @@ -693,26 +685,26 @@ fn test_git_colocated_squash_undo() { test_env.jj_cmd_ok(&repo_path, &["git", "init", "--git-repo=."]); test_env.jj_cmd_ok(&repo_path, &["ci", "-m=A"]); // Test the setup - insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r" @ rlvkpnrzqnoo 9670380ac379 ○ qpvuntsmwlqt a7e4cec4256b A git_head() ◆ zzzzzzzzzzzz 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["squash"]); - insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r" @ zsuskulnrvyr 6ee662324e5a ○ qpvuntsmwlqt 13ab6b96d82e A git_head() ◆ zzzzzzzzzzzz 000000000000 - "#); + "); test_env.jj_cmd_ok(&repo_path, &["undo"]); // TODO: There should be no divergence here; 2f376ea1478c should be hidden // (#922) - insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output_divergence(&test_env, &repo_path), @r" @ rlvkpnrzqnoo 9670380ac379 ○ qpvuntsmwlqt a7e4cec4256b A git_head() ◆ zzzzzzzzzzzz 000000000000 - "#); + "); } #[test] @@ -727,29 +719,29 @@ fn test_git_colocated_undo_head_move() { insta::assert_snapshot!( git_repo.head().unwrap().target().unwrap().to_string(), @"230dd059e1b059aefc0da06a2e5a7dbf22362f22"); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 65b6b74e08973b88d38404430f119c8c79465250 ○ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 git_head() ◆ 0000000000000000000000000000000000000000 - "#); + "); // HEAD should be unset test_env.jj_cmd_ok(&repo_path, &["undo"]); assert!(git_repo.head().is_err()); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Create commit on non-root commit test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 69b19f73cf584f162f078fb0d91c55ca39d10bc7 ○ eb08b363bb5ef8ee549314260488980d7bbe8f63 git_head() ○ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "#); + "); insta::assert_snapshot!( git_repo.head().unwrap().target().unwrap().to_string(), @"eb08b363bb5ef8ee549314260488980d7bbe8f63"); @@ -757,19 +749,19 @@ fn test_git_colocated_undo_head_move() { // HEAD should be moved back let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["undo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Undid operation: b50ec983d1c1 (2001-02-03 08:05:13) new empty commit Working copy now at: royxmykx eb08b363 (empty) (no description set) Parent commit : qpvuntsm 230dd059 (empty) (no description set) - "#); + "); insta::assert_snapshot!( git_repo.head().unwrap().target().unwrap().to_string(), @"230dd059e1b059aefc0da06a2e5a7dbf22362f22"); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ eb08b363bb5ef8ee549314260488980d7bbe8f63 ○ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 git_head() ◆ 0000000000000000000000000000000000000000 - "#); + "); } #[test] @@ -792,64 +784,64 @@ fn test_git_colocated_update_index_preserves_timestamps() { test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "commit2"]); test_env.jj_cmd_ok(&repo_path, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 051508d190ffd04fe2d79367ad8e9c3713ac2375 ○ 563dbc583c0d82eb10c40d3f3276183ea28a0fa7 commit2 git_head() ○ 3c270b473dd871b20d196316eb038f078f80c219 commit1 ◆ 0000000000000000000000000000000000000000 - "#); + "); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) ed48318d9bf4 ctime=0:0 mtime=0:0 size=0 file1.txt Unconflicted Mode(FILE) 2e0996000b7e ctime=0:0 mtime=0:0 size=0 file2.txt Unconflicted Mode(FILE) d5f7fc3f74f7 ctime=0:0 mtime=0:0 size=0 file4.txt - "#); + "); // Update index with stats for all files. We may want to do this automatically // in the future after we update the index in `git::reset_head` (#3786), but for // now, we at least want to preserve existing stat information when possible. update_git_index(&repo_path); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) ed48318d9bf4 ctime=[nonzero] mtime=[nonzero] size=18 file1.txt Unconflicted Mode(FILE) 2e0996000b7e ctime=[nonzero] mtime=[nonzero] size=9 file2.txt Unconflicted Mode(FILE) d5f7fc3f74f7 ctime=[nonzero] mtime=[nonzero] size=6 file4.txt - "#); + "); // Edit parent commit, causing the changes to be removed from the index without // touching the working copy test_env.jj_cmd_ok(&repo_path, &["edit", "commit2"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 563dbc583c0d82eb10c40d3f3276183ea28a0fa7 commit2 ○ 3c270b473dd871b20d196316eb038f078f80c219 commit1 git_head() ◆ 0000000000000000000000000000000000000000 - "#); + "); // Index should contain stat for unchanged file still. - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) ed48318d9bf4 ctime=[nonzero] mtime=[nonzero] size=18 file1.txt Unconflicted Mode(FILE) 28d2718c947b ctime=0:0 mtime=0:0 size=0 file2.txt Unconflicted Mode(FILE) 528557ab3a42 ctime=0:0 mtime=0:0 size=0 file3.txt - "#); + "); // Create sibling commit, causing working copy to match index test_env.jj_cmd_ok(&repo_path, &["new", "commit1"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ ccb1b1807383dba5ff4d335fd9fb92aa540f4632 │ ○ 563dbc583c0d82eb10c40d3f3276183ea28a0fa7 commit2 ├─╯ ○ 3c270b473dd871b20d196316eb038f078f80c219 commit1 git_head() ◆ 0000000000000000000000000000000000000000 - "#); + "); // Index should contain stat for unchanged file still. - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) ed48318d9bf4 ctime=[nonzero] mtime=[nonzero] size=18 file1.txt Unconflicted Mode(FILE) 28d2718c947b ctime=0:0 mtime=0:0 size=0 file2.txt Unconflicted Mode(FILE) 528557ab3a42 ctime=0:0 mtime=0:0 size=0 file3.txt - "#); + "); } #[test] @@ -873,23 +865,23 @@ fn test_git_colocated_update_index_merge_conflict() { std::fs::write(repo_path.join("right.txt"), "right\n").unwrap(); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "right"]); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 base.txt Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt - "#); + "); // Update index with stat for base.txt update_git_index(&repo_path); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt - "#); + "); // Create merge conflict test_env.jj_cmd_ok(&repo_path, &["new", "left", "right"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ aea7acd77752c3f74914de1fe327075a579bf7c6 ├─╮ │ ○ df62ad35fc873e89ade730fa9a407cd5cfa5e6ba right @@ -897,22 +889,22 @@ fn test_git_colocated_update_index_merge_conflict() { ├─╯ ○ 14b3ff6c73a234ab2a26fc559512e0f056a46bd9 base ◆ 0000000000000000000000000000000000000000 - "#); + "); // Conflict should be added in index with correct blob IDs. The stat for // base.txt should not change. - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Base Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt Ours Mode(FILE) 45cf141ba67d ctime=0:0 mtime=0:0 size=0 conflict.txt Theirs Mode(FILE) c376d892e8b1 ctime=0:0 mtime=0:0 size=0 conflict.txt Unconflicted Mode(FILE) 45cf141ba67d ctime=0:0 mtime=0:0 size=0 left.txt Unconflicted Mode(FILE) c376d892e8b1 ctime=0:0 mtime=0:0 size=0 right.txt - "#); + "); test_env.jj_cmd_ok(&repo_path, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ cae33b49a8a514996983caaf171c5edbf0d70e78 × aea7acd77752c3f74914de1fe327075a579bf7c6 git_head() ├─╮ @@ -921,17 +913,17 @@ fn test_git_colocated_update_index_merge_conflict() { ├─╯ ○ 14b3ff6c73a234ab2a26fc559512e0f056a46bd9 base ◆ 0000000000000000000000000000000000000000 - "#); + "); // Index should be the same after `jj new`. - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Base Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt Ours Mode(FILE) 45cf141ba67d ctime=0:0 mtime=0:0 size=0 conflict.txt Theirs Mode(FILE) c376d892e8b1 ctime=0:0 mtime=0:0 size=0 conflict.txt Unconflicted Mode(FILE) 45cf141ba67d ctime=0:0 mtime=0:0 size=0 left.txt Unconflicted Mode(FILE) c376d892e8b1 ctime=0:0 mtime=0:0 size=0 right.txt - "#); + "); } #[test] @@ -957,65 +949,65 @@ fn test_git_colocated_update_index_rebase_conflict() { test_env.jj_cmd_ok(&repo_path, &["edit", "left"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 68cc2177623364e4f0719d6ec8da1d6ea8d6087e left │ ○ df62ad35fc873e89ade730fa9a407cd5cfa5e6ba right ├─╯ ○ 14b3ff6c73a234ab2a26fc559512e0f056a46bd9 base git_head() ◆ 0000000000000000000000000000000000000000 - "#); + "); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 base.txt Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt - "#); + "); // Update index with stat for base.txt update_git_index(&repo_path); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt - "#); + "); // Create rebase conflict test_env.jj_cmd_ok(&repo_path, &["rebase", "-r", "left", "-d", "right"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 233cb41e128e74aa2fcbf01c85d69b33a118faa8 left ○ df62ad35fc873e89ade730fa9a407cd5cfa5e6ba right git_head() ○ 14b3ff6c73a234ab2a26fc559512e0f056a46bd9 base ◆ 0000000000000000000000000000000000000000 - "#); + "); // Index should contain files from parent commit, so there should be no conflict // in conflict.txt yet. The stat for base.txt should not change. - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Unconflicted Mode(FILE) c376d892e8b1 ctime=0:0 mtime=0:0 size=0 conflict.txt Unconflicted Mode(FILE) c376d892e8b1 ctime=0:0 mtime=0:0 size=0 right.txt - "#); + "); test_env.jj_cmd_ok(&repo_path, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 6d84b9021f9e07b69770687071c4e8e71113e688 × 233cb41e128e74aa2fcbf01c85d69b33a118faa8 left git_head() ○ df62ad35fc873e89ade730fa9a407cd5cfa5e6ba right ○ 14b3ff6c73a234ab2a26fc559512e0f056a46bd9 base ◆ 0000000000000000000000000000000000000000 - "#); + "); // Now the working copy commit's parent is conflicted, so the index should have // a conflict with correct blob IDs. - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Base Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt Ours Mode(FILE) c376d892e8b1 ctime=0:0 mtime=0:0 size=0 conflict.txt Theirs Mode(FILE) 45cf141ba67d ctime=0:0 mtime=0:0 size=0 conflict.txt Unconflicted Mode(FILE) 45cf141ba67d ctime=0:0 mtime=0:0 size=0 left.txt Unconflicted Mode(FILE) c376d892e8b1 ctime=0:0 mtime=0:0 size=0 right.txt - "#); + "); } #[test] @@ -1044,23 +1036,23 @@ fn test_git_colocated_update_index_3_sided_conflict() { std::fs::write(repo_path.join("side-3.txt"), "side-3\n").unwrap(); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "side-3"]); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 base.txt Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt - "#); + "); // Update index with stat for base.txt update_git_index(&repo_path); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Unconflicted Mode(FILE) df967b96a579 ctime=0:0 mtime=0:0 size=0 conflict.txt - "#); + "); // Create 3-sided merge conflict test_env.jj_cmd_ok(&repo_path, &["new", "side-1", "side-2", "side-3"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ faee07ad76218d193f2784f4988daa2ac46db30c ├─┬─╮ │ │ ○ 86e722ea6a9da2551f1e05bc9aa914acd1cb2304 side-3 @@ -1070,22 +1062,22 @@ fn test_git_colocated_update_index_3_sided_conflict() { ├─╯ ○ 14b3ff6c73a234ab2a26fc559512e0f056a46bd9 base ◆ 0000000000000000000000000000000000000000 - "#); + "); // We can't add conflicts with more than 2 sides to the index, so we add a dummy // conflict instead. The stat for base.txt should not change. - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Ours Mode(FILE) eb8299123d2a ctime=0:0 mtime=0:0 size=0 .jj-do-not-resolve-this-conflict Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Unconflicted Mode(FILE) dd8f930010b3 ctime=0:0 mtime=0:0 size=0 conflict.txt Unconflicted Mode(FILE) dd8f930010b3 ctime=0:0 mtime=0:0 size=0 side-1.txt Unconflicted Mode(FILE) 7b44e11df720 ctime=0:0 mtime=0:0 size=0 side-2.txt Unconflicted Mode(FILE) 42f37a71bf20 ctime=0:0 mtime=0:0 size=0 side-3.txt - "#); + "); test_env.jj_cmd_ok(&repo_path, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ b0e5644063c2a12fb265e5f65cd88c6a2e1cf865 × faee07ad76218d193f2784f4988daa2ac46db30c git_head() ├─┬─╮ @@ -1096,30 +1088,30 @@ fn test_git_colocated_update_index_3_sided_conflict() { ├─╯ ○ 14b3ff6c73a234ab2a26fc559512e0f056a46bd9 base ◆ 0000000000000000000000000000000000000000 - "#); + "); // Index should be the same after `jj new`. - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Ours Mode(FILE) eb8299123d2a ctime=0:0 mtime=0:0 size=0 .jj-do-not-resolve-this-conflict Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Unconflicted Mode(FILE) dd8f930010b3 ctime=0:0 mtime=0:0 size=0 conflict.txt Unconflicted Mode(FILE) dd8f930010b3 ctime=0:0 mtime=0:0 size=0 side-1.txt Unconflicted Mode(FILE) 7b44e11df720 ctime=0:0 mtime=0:0 size=0 side-2.txt Unconflicted Mode(FILE) 42f37a71bf20 ctime=0:0 mtime=0:0 size=0 side-3.txt - "#); + "); // If we add a file named ".jj-do-not-resolve-this-conflict", it should take // precedence over the dummy conflict. std::fs::write(repo_path.join(".jj-do-not-resolve-this-conflict"), "file\n").unwrap(); test_env.jj_cmd_ok(&repo_path, &["new"]); - insta::assert_snapshot!(get_index_state(&repo_path), @r#" + insta::assert_snapshot!(get_index_state(&repo_path), @r" Unconflicted Mode(FILE) f73f3093ff86 ctime=0:0 mtime=0:0 size=0 .jj-do-not-resolve-this-conflict Unconflicted Mode(FILE) df967b96a579 ctime=[nonzero] mtime=[nonzero] size=5 base.txt Unconflicted Mode(FILE) dd8f930010b3 ctime=0:0 mtime=0:0 size=0 conflict.txt Unconflicted Mode(FILE) dd8f930010b3 ctime=0:0 mtime=0:0 size=0 side-1.txt Unconflicted Mode(FILE) 7b44e11df720 ctime=0:0 mtime=0:0 size=0 side-2.txt Unconflicted Mode(FILE) 42f37a71bf20 ctime=0:0 mtime=0:0 size=0 side-3.txt - "#); + "); } fn get_log_output_divergence(test_env: &TestEnvironment, repo_path: &Path) -> String { @@ -1257,11 +1249,11 @@ fn test_git_colocated_unreachable_commits() { // Import the repo while there is no path to the second commit test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 66ae47cee4f8c28ee8d7e4f5d9401b03c07e22f2 ○ 2ee37513d2b5e549f7478c671a780053614bff19 master git_head() initial ◆ 0000000000000000000000000000000000000000 - "#); + "); insta::assert_snapshot!( git_repo.head().unwrap().peel_to_commit().unwrap().id().to_string(), @"2ee37513d2b5e549f7478c671a780053614bff19" diff --git a/cli/tests/test_git_fetch.rs b/cli/tests/test_git_fetch.rs index 6956525eda..9528a16d04 100644 --- a/cli/tests/test_git_fetch.rs +++ b/cli/tests/test_git_fetch.rs @@ -127,9 +127,7 @@ fn test_git_fetch_with_default_config(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" - origin@origin: oputwtnw ffecd2d6 message - "###); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"origin@origin: oputwtnw ffecd2d6 message"); } } @@ -147,10 +145,10 @@ fn test_git_fetch_default_remote(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin: oputwtnw ffecd2d6 message @origin: oputwtnw ffecd2d6 message - "###); + "); } } @@ -168,16 +166,16 @@ fn test_git_fetch_single_remote(subprocess: bool) { let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Hint: Fetching from the only existing remote: rem1 bookmark: rem1@rem1 [new] tracked - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1: qxosxrvv 6a211027 message @rem1: qxosxrvv 6a211027 message - "###); + "); } } @@ -198,10 +196,10 @@ fn test_git_fetch_single_remote_all_remotes_flag(subprocess: bool) { .assert() .success(); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1: qxosxrvv 6a211027 message @rem1: qxosxrvv 6a211027 message - "###); + "); } } @@ -219,10 +217,10 @@ fn test_git_fetch_single_remote_from_arg(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote", "rem1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1: qxosxrvv 6a211027 message @rem1: qxosxrvv 6a211027 message - "###); + "); } } @@ -241,10 +239,10 @@ fn test_git_fetch_single_remote_from_config(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1: qxosxrvv 6a211027 message @rem1: qxosxrvv 6a211027 message - "###); + "); } } @@ -266,12 +264,12 @@ fn test_git_fetch_multiple_remotes(subprocess: bool) { &["git", "fetch", "--remote", "rem1", "--remote", "rem2"], ); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1: qxosxrvv 6a211027 message @rem1: qxosxrvv 6a211027 message rem2: yszkquru 2497a8a0 message @rem2: yszkquru 2497a8a0 message - "###); + "); } } @@ -294,12 +292,12 @@ fn test_git_fetch_all_remotes(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--all-remotes"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1: qxosxrvv 6a211027 message @rem1: qxosxrvv 6a211027 message rem2: yszkquru 2497a8a0 message @rem2: yszkquru 2497a8a0 message - "###); + "); } } @@ -319,12 +317,12 @@ fn test_git_fetch_multiple_remotes_from_config(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1: qxosxrvv 6a211027 message @rem1: qxosxrvv 6a211027 message rem2: yszkquru 2497a8a0 message @rem2: yszkquru 2497a8a0 message - "###); + "); } } @@ -394,11 +392,11 @@ fn test_git_fetch_from_remote_named_git(subprocess: bool) { // Try fetching from the remote named 'git'. let stderr = &test_env.jj_cmd_failure(&repo_path, &["git", "fetch", "--remote=git"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Failed to import refs from underlying Git repo Caused by: Git remote named 'git' is reserved for local Git repository Hint: Run `jj git remote rename` to give different name. - "###); + "); } // Implicit import shouldn't fail because of the remote ref. @@ -422,16 +420,14 @@ fn test_git_fetch_from_remote_named_git(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["git", "remote", "rename", "git", "bar"]); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "list", "--all-remotes"]); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" git: mrylzrtu 76fc7466 message @bar: mrylzrtu 76fc7466 message @git: mrylzrtu 76fc7466 message - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Done importing changes from the underlying Git repo. - "###); + insta::assert_snapshot!(stderr, @"Done importing changes from the underlying Git repo."); } } @@ -448,10 +444,10 @@ fn test_git_fetch_prune_before_updating_tips(subprocess: bool) { let git_repo = add_git_remote(&test_env, &repo_path, "origin"); test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin: oputwtnw ffecd2d6 message @origin: oputwtnw ffecd2d6 message - "###); + "); } // Remove origin bookmark in git repo and create origin/subname @@ -463,10 +459,10 @@ fn test_git_fetch_prune_before_updating_tips(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin/subname: oputwtnw ffecd2d6 message @origin: oputwtnw ffecd2d6 message - "###); + "); } } @@ -486,9 +482,7 @@ fn test_git_fetch_conflicting_bookmarks(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["new", "root()"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "rem1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" - rem1: kkmpptxz fcdbbd73 (empty) (no description set) - "###); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"rem1: kkmpptxz fcdbbd73 (empty) (no description set)"); } test_env.jj_cmd_ok( @@ -497,12 +491,12 @@ fn test_git_fetch_conflicting_bookmarks(subprocess: bool) { ); // This should result in a CONFLICTED bookmark insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1 (conflicted): + kkmpptxz fcdbbd73 (empty) (no description set) + qxosxrvv 6a211027 message @rem1 (behind by 1 commits): qxosxrvv 6a211027 message - "###); + "); } } @@ -527,10 +521,10 @@ fn test_git_fetch_conflicting_bookmarks_colocated(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["new", "root()"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "rem1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1: zsuskuln f652c321 (empty) (no description set) @git: zsuskuln f652c321 (empty) (no description set) - "###); + "); } test_env.jj_cmd_ok( @@ -540,13 +534,13 @@ fn test_git_fetch_conflicting_bookmarks_colocated(subprocess: bool) { // This should result in a CONFLICTED bookmark // See https://github.com/jj-vcs/jj/pull/1146#discussion_r1112372340 for the bug this tests for. insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" rem1 (conflicted): + zsuskuln f652c321 (empty) (no description set) + qxosxrvv 6a211027 message @git (behind by 1 commits): zsuskuln f652c321 (empty) (no description set) @rem1 (behind by 1 commits): qxosxrvv 6a211027 message - "###); + "); } } @@ -598,17 +592,17 @@ fn test_git_fetch_all(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/target" Nothing changed. - "###); + "#); } let target_jj_repo_path = test_env.env_root().join("target"); let source_log = create_colocated_repo_and_bookmarks_from_trunk1(&test_env, &source_git_repo_path); insta::allow_duplicates! { - insta::assert_snapshot!(source_log, @r###" + insta::assert_snapshot!(source_log, @r" ===== Source git repo contents ===== @ c7d4bdcbc215 descr_for_b b │ ○ decaa3966c83 descr_for_a2 a2 @@ -617,15 +611,15 @@ fn test_git_fetch_all(subprocess: bool) { ├─╯ ○ ff36dc55760e descr_for_trunk1 trunk1 ◆ 000000000000 - "###); + "); } // Nothing in our repo before the fetch insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 ◆ 000000000000 - "###); + "); } insta::allow_duplicates! { insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @""); @@ -635,15 +629,15 @@ fn test_git_fetch_all(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: a1@origin [new] tracked bookmark: a2@origin [new] tracked bookmark: b@origin [new] tracked bookmark: trunk1@origin [new] tracked - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r" a1: nknoxmzm 359a9a02 descr_for_a1 @origin: nknoxmzm 359a9a02 descr_for_a1 a2: qkvnknrk decaa396 descr_for_a2 @@ -652,10 +646,10 @@ fn test_git_fetch_all(subprocess: bool) { @origin: vpupmnsl c7d4bdcb descr_for_b trunk1: zowqyktl ff36dc55 descr_for_trunk1 @origin: zowqyktl ff36dc55 descr_for_trunk1 - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ c7d4bdcbc215 descr_for_b b │ │ ○ decaa3966c83 descr_for_a2 a2 @@ -665,14 +659,14 @@ fn test_git_fetch_all(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "#); + "); } // ==== Change both repos ==== // First, change the target repo: let source_log = create_trunk2_and_rebase_bookmarks(&test_env, &source_git_repo_path); insta::allow_duplicates! { - insta::assert_snapshot!(source_log, @r###" + insta::assert_snapshot!(source_log, @r" ===== Source git repo contents ===== ○ babc49226c14 descr_for_b b │ ○ 91e46b4b2653 descr_for_a2 a2 @@ -682,7 +676,7 @@ fn test_git_fetch_all(subprocess: bool) { @ 8f1f14fbbf42 descr_for_trunk2 trunk2 ○ ff36dc55760e descr_for_trunk1 trunk1 ◆ 000000000000 - "###); + "); } // Change a bookmark in the source repo as well, so that it becomes conflicted. test_env.jj_cmd_ok( @@ -692,7 +686,7 @@ fn test_git_fetch_all(subprocess: bool) { // Our repo before and after fetch insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ 061eddbb43ab new_descr_for_b_to_create_conflict b* │ │ ○ decaa3966c83 descr_for_a2 a2 @@ -702,10 +696,10 @@ fn test_git_fetch_all(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "#); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r" a1: nknoxmzm 359a9a02 descr_for_a1 @origin: nknoxmzm 359a9a02 descr_for_a1 a2: qkvnknrk decaa396 descr_for_a2 @@ -714,23 +708,23 @@ fn test_git_fetch_all(subprocess: bool) { @origin (ahead by 1 commits, behind by 1 commits): vpupmnsl hidden c7d4bdcb descr_for_b trunk1: zowqyktl ff36dc55 descr_for_trunk1 @origin: zowqyktl ff36dc55 descr_for_trunk1 - "###); + "); } let (stdout, stderr) = test_env.jj_cmd_ok(&target_jj_repo_path, &["git", "fetch"]); insta::allow_duplicates! { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: a1@origin [updated] tracked bookmark: a2@origin [updated] tracked bookmark: b@origin [updated] tracked bookmark: trunk2@origin [new] tracked Abandoned 2 commits that are no longer reachable. - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r" a1: quxllqov 0424f6df descr_for_a1 @origin: quxllqov 0424f6df descr_for_a1 a2: osusxwst 91e46b4b descr_for_a2 @@ -744,10 +738,10 @@ fn test_git_fetch_all(subprocess: bool) { @origin: zowqyktl ff36dc55 descr_for_trunk1 trunk2: umznmzko 8f1f14fb descr_for_trunk2 @origin: umznmzko 8f1f14fb descr_for_trunk2 - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ babc49226c14 descr_for_b b?? b@origin │ │ ○ 91e46b4b2653 descr_for_a2 a2 @@ -760,7 +754,7 @@ fn test_git_fetch_all(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "#); + "); } } @@ -783,17 +777,17 @@ fn test_git_fetch_some_of_many_bookmarks(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/target" Nothing changed. - "###); + "#); } let target_jj_repo_path = test_env.env_root().join("target"); let source_log = create_colocated_repo_and_bookmarks_from_trunk1(&test_env, &source_git_repo_path); insta::allow_duplicates! { - insta::assert_snapshot!(source_log, @r###" + insta::assert_snapshot!(source_log, @r" ===== Source git repo contents ===== @ c7d4bdcbc215 descr_for_b b │ ○ decaa3966c83 descr_for_a2 a2 @@ -802,7 +796,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { ├─╯ ○ ff36dc55760e descr_for_trunk1 trunk1 ◆ 000000000000 - "###); + "); } // Test an error message @@ -823,10 +817,10 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { // Nothing in our repo before the fetch insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 ◆ 000000000000 - "###); + "); } // Fetch one bookmark... let (stdout, stderr) = @@ -835,25 +829,23 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - bookmark: b@origin [new] tracked - "###); + insta::assert_snapshot!(stderr, @"bookmark: b@origin [new] tracked"); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ c7d4bdcbc215 descr_for_b b │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "#); + "); } // ...check what the intermediate state looks like... insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r" b: vpupmnsl c7d4bdcb descr_for_b @origin: vpupmnsl c7d4bdcb descr_for_b - "###); + "); } // ...then fetch two others with a glob. let (stdout, stderr) = test_env.jj_cmd_ok( @@ -864,13 +856,13 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: a1@origin [new] tracked bookmark: a2@origin [new] tracked - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ decaa3966c83 descr_for_a2 a2 │ │ ○ 359a9a02457d descr_for_a1 a1 @@ -880,7 +872,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "#); + "); } // Fetching the same bookmark again let (stdout, stderr) = @@ -909,7 +901,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { // First, change the target repo: let source_log = create_trunk2_and_rebase_bookmarks(&test_env, &source_git_repo_path); insta::allow_duplicates! { - insta::assert_snapshot!(source_log, @r###" + insta::assert_snapshot!(source_log, @r" ===== Source git repo contents ===== ○ 01d115196c39 descr_for_b b │ ○ 31c7d94b1f29 descr_for_a2 a2 @@ -919,7 +911,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { @ 2bb3ebd2bba3 descr_for_trunk2 trunk2 ○ ff36dc55760e descr_for_trunk1 trunk1 ◆ 000000000000 - "###); + "); } // Change a bookmark in the source repo as well, so that it becomes conflicted. test_env.jj_cmd_ok( @@ -929,7 +921,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { // Our repo before and after fetch of two bookmarks insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ 6ebd41dc4f13 new_descr_for_b_to_create_conflict b* │ │ ○ decaa3966c83 descr_for_a2 a2 @@ -939,7 +931,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "#); + "); } let (stdout, stderr) = test_env.jj_cmd_ok( &target_jj_repo_path, @@ -949,14 +941,14 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: a1@origin [updated] tracked bookmark: b@origin [updated] tracked Abandoned 1 commits that are no longer reachable. - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ 01d115196c39 descr_for_b b?? b@origin │ │ ○ 6df2d34cf0da descr_for_a1 a1 @@ -969,12 +961,12 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "#); + "); } // We left a2 where it was before, let's see how `jj bookmark list` sees this. insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r" a1: ypowunwp 6df2d34c descr_for_a1 @origin: ypowunwp 6df2d34c descr_for_a1 a2: qkvnknrk decaa396 descr_for_a2 @@ -984,7 +976,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { + vpupmnsl 6ebd41dc new_descr_for_b_to_create_conflict + nxrpswuq 01d11519 descr_for_b @origin (behind by 1 commits): nxrpswuq 01d11519 descr_for_b - "###); + "); } // Now, let's fetch a2 and double-check that fetching a1 and b again doesn't do // anything. @@ -996,13 +988,13 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: a2@origin [updated] tracked Abandoned 1 commits that are no longer reachable. - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ 31c7d94b1f29 descr_for_a2 a2 │ │ ○ 01d115196c39 descr_for_b b?? b@origin @@ -1015,10 +1007,10 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "#); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &target_jj_repo_path), @r" a1: ypowunwp 6df2d34c descr_for_a1 @origin: ypowunwp 6df2d34c descr_for_a1 a2: qrmzolkr 31c7d94b descr_for_a2 @@ -1028,7 +1020,7 @@ fn test_git_fetch_some_of_many_bookmarks(subprocess: bool) { + vpupmnsl 6ebd41dc new_descr_for_b_to_create_conflict + nxrpswuq 01d11519 descr_for_b @origin (behind by 1 commits): nxrpswuq 01d11519 descr_for_b - "###); + "); } } @@ -1051,10 +1043,10 @@ fn test_git_fetch_bookmarks_some_missing(subprocess: bool) { let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--branch", "noexist"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No branch matching `noexist` found on any specified/configured remote Nothing changed. - "###); + "); } insta::allow_duplicates! { insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @""); @@ -1068,11 +1060,11 @@ fn test_git_fetch_bookmarks_some_missing(subprocess: bool) { ], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No branch matching `noexist1` found on any specified/configured remote Warning: No branch matching `noexist2` found on any specified/configured remote Nothing changed. - "###); + "); } insta::allow_duplicates! { insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @""); @@ -1081,15 +1073,13 @@ fn test_git_fetch_bookmarks_some_missing(subprocess: bool) { // single existing bookmark, implicit remotes (@origin) let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--branch", "origin"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - bookmark: origin@origin [new] tracked - "###); + insta::assert_snapshot!(stderr, @"bookmark: origin@origin [new] tracked"); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin: oputwtnw ffecd2d6 message @origin: oputwtnw ffecd2d6 message - "###); + "); } // multiple existing bookmark, explicit remotes, each bookmark is only in one @@ -1110,15 +1100,15 @@ fn test_git_fetch_bookmarks_some_missing(subprocess: bool) { } insta::allow_duplicates! { insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" - origin: oputwtnw ffecd2d6 message - @origin: oputwtnw ffecd2d6 message - rem1: qxosxrvv 6a211027 message - @rem1: qxosxrvv 6a211027 message - rem2: yszkquru 2497a8a0 message - @rem2: yszkquru 2497a8a0 message - rem3: lvsrtwwm 4ffdff2b message - @rem3: lvsrtwwm 4ffdff2b message - "); + origin: oputwtnw ffecd2d6 message + @origin: oputwtnw ffecd2d6 message + rem1: qxosxrvv 6a211027 message + @rem1: qxosxrvv 6a211027 message + rem2: yszkquru 2497a8a0 message + @rem2: yszkquru 2497a8a0 message + rem3: lvsrtwwm 4ffdff2b message + @rem3: lvsrtwwm 4ffdff2b message + "); } // multiple bookmarks, one exists, one doesn't @@ -1129,10 +1119,10 @@ fn test_git_fetch_bookmarks_some_missing(subprocess: bool) { ], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No branch matching `notexist` found on any specified/configured remote Nothing changed. - "###); + "); } insta::allow_duplicates! { insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" @@ -1196,17 +1186,17 @@ fn test_git_fetch_undo(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/target" Nothing changed. - "###); + "#); } let target_jj_repo_path = test_env.env_root().join("target"); let source_log = create_colocated_repo_and_bookmarks_from_trunk1(&test_env, &source_git_repo_path); insta::allow_duplicates! { - insta::assert_snapshot!(source_log, @r###" + insta::assert_snapshot!(source_log, @r" ===== Source git repo contents ===== @ c7d4bdcbc215 descr_for_b b │ ○ decaa3966c83 descr_for_a2 a2 @@ -1215,7 +1205,7 @@ fn test_git_fetch_undo(subprocess: bool) { ├─╯ ○ ff36dc55760e descr_for_trunk1 trunk1 ◆ 000000000000 - "###); + "); } // Fetch 2 bookmarks @@ -1295,17 +1285,17 @@ fn test_fetch_undo_what(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/target" Nothing changed. - "###); + "#); } let repo_path = test_env.env_root().join("target"); let source_log = create_colocated_repo_and_bookmarks_from_trunk1(&test_env, &source_git_repo_path); insta::allow_duplicates! { - insta::assert_snapshot!(source_log, @r###" + insta::assert_snapshot!(source_log, @r" ===== Source git repo contents ===== @ c7d4bdcbc215 descr_for_b b │ ○ decaa3966c83 descr_for_a2 a2 @@ -1314,7 +1304,7 @@ fn test_fetch_undo_what(subprocess: bool) { ├─╯ ○ ff36dc55760e descr_for_trunk1 trunk1 ◆ 000000000000 - "###); + "); } // Initial state we will try to return to after `op restore`. There are no @@ -1330,24 +1320,22 @@ fn test_fetch_undo_what(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - bookmark: b@origin [new] tracked - "###); + insta::assert_snapshot!(stderr, @"bookmark: b@origin [new] tracked"); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 230dd059e1b0 │ ○ c7d4bdcbc215 descr_for_b b │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "#); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" b: vpupmnsl c7d4bdcb descr_for_b @origin: vpupmnsl c7d4bdcb descr_for_b - "###); + "); } // We can undo the change in the repo without moving the remote-tracking @@ -1360,26 +1348,24 @@ fn test_fetch_undo_what(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" - Restored to operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default' - "#); + insta::assert_snapshot!(stderr, @"Restored to operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default'"); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" b (deleted) @origin: vpupmnsl hidden c7d4bdcb descr_for_b - "###); + "); } // Now, let's demo restoring just the remote-tracking bookmark. First, let's // change our local repo state... test_env.jj_cmd_ok(&repo_path, &["bookmark", "c", "newbookmark"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" b (deleted) @origin: vpupmnsl hidden c7d4bdcb descr_for_b newbookmark: qpvuntsm 230dd059 (empty) (no description set) - "###); + "); } // Restoring just the remote-tracking state will not affect `newbookmark`, but // will eliminate `b@origin`. @@ -1397,14 +1383,10 @@ fn test_fetch_undo_what(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" - Restored to operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default' - "#); + insta::assert_snapshot!(stderr, @"Restored to operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default'"); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" - newbookmark: qpvuntsm 230dd059 (empty) (no description set) - "###); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"newbookmark: qpvuntsm 230dd059 (empty) (no description set)"); } } @@ -1422,28 +1404,26 @@ fn test_git_fetch_remove_fetch(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "origin"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" - origin: qpvuntsm 230dd059 (empty) (no description set) - "###); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"origin: qpvuntsm 230dd059 (empty) (no description set)"); } test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin (conflicted): + qpvuntsm 230dd059 (empty) (no description set) + oputwtnw ffecd2d6 message @origin (behind by 1 commits): oputwtnw ffecd2d6 message - "###); + "); } test_env.jj_cmd_ok(&repo_path, &["git", "remote", "remove", "origin"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin (conflicted): + qpvuntsm 230dd059 (empty) (no description set) + oputwtnw ffecd2d6 message - "###); + "); } test_env.jj_cmd_ok(&repo_path, &["git", "remote", "add", "origin", "../origin"]); @@ -1454,17 +1434,15 @@ fn test_git_fetch_remove_fetch(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - bookmark: origin@origin [new] tracked - "###); + insta::assert_snapshot!(stderr, @"bookmark: origin@origin [new] tracked"); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin (conflicted): + qpvuntsm 230dd059 (empty) (no description set) + oputwtnw ffecd2d6 message @origin (behind by 1 commits): oputwtnw ffecd2d6 message - "###); + "); } } @@ -1482,19 +1460,17 @@ fn test_git_fetch_rename_fetch(subprocess: bool) { test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "origin"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" - origin: qpvuntsm 230dd059 (empty) (no description set) - "###); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"origin: qpvuntsm 230dd059 (empty) (no description set)"); } test_env.jj_cmd_ok(&repo_path, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin (conflicted): + qpvuntsm 230dd059 (empty) (no description set) + oputwtnw ffecd2d6 message @origin (behind by 1 commits): oputwtnw ffecd2d6 message - "###); + "); } test_env.jj_cmd_ok( @@ -1502,12 +1478,12 @@ fn test_git_fetch_rename_fetch(subprocess: bool) { &["git", "remote", "rename", "origin", "upstream"], ); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" origin (conflicted): + qpvuntsm 230dd059 (empty) (no description set) + oputwtnw ffecd2d6 message @upstream (behind by 1 commits): oputwtnw ffecd2d6 message - "###); + "); } // Check that jj indicates that nothing has changed @@ -1517,9 +1493,7 @@ fn test_git_fetch_rename_fetch(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); } } @@ -1541,17 +1515,17 @@ fn test_git_fetch_removed_bookmark(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/target" Nothing changed. - "###); + "#); } let target_jj_repo_path = test_env.env_root().join("target"); let source_log = create_colocated_repo_and_bookmarks_from_trunk1(&test_env, &source_git_repo_path); insta::allow_duplicates! { - insta::assert_snapshot!(source_log, @r###" + insta::assert_snapshot!(source_log, @r" ===== Source git repo contents ===== @ c7d4bdcbc215 descr_for_b b │ ○ decaa3966c83 descr_for_a2 a2 @@ -1560,7 +1534,7 @@ fn test_git_fetch_removed_bookmark(subprocess: bool) { ├─╯ ○ ff36dc55760e descr_for_trunk1 trunk1 ◆ 000000000000 - "###); + "); } // Fetch all bookmarks @@ -1569,15 +1543,15 @@ fn test_git_fetch_removed_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: a1@origin [new] tracked bookmark: a2@origin [new] tracked bookmark: b@origin [new] tracked bookmark: trunk1@origin [new] tracked - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ c7d4bdcbc215 descr_for_b b │ │ ○ decaa3966c83 descr_for_a2 a2 @@ -1587,7 +1561,7 @@ fn test_git_fetch_removed_bookmark(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "#); + "); } // Remove a2 bookmark in origin @@ -1600,12 +1574,10 @@ fn test_git_fetch_removed_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ c7d4bdcbc215 descr_for_b b │ │ ○ decaa3966c83 descr_for_a2 a2 @@ -1615,7 +1587,7 @@ fn test_git_fetch_removed_bookmark(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "#); + "); } // Fetch bookmarks a2 from origin, and check that it has been removed locally @@ -1659,17 +1631,17 @@ fn test_git_fetch_removed_parent_bookmark(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/target" Nothing changed. - "###); + "#); } let target_jj_repo_path = test_env.env_root().join("target"); let source_log = create_colocated_repo_and_bookmarks_from_trunk1(&test_env, &source_git_repo_path); insta::allow_duplicates! { - insta::assert_snapshot!(source_log, @r###" + insta::assert_snapshot!(source_log, @r" ===== Source git repo contents ===== @ c7d4bdcbc215 descr_for_b b │ ○ decaa3966c83 descr_for_a2 a2 @@ -1678,7 +1650,7 @@ fn test_git_fetch_removed_parent_bookmark(subprocess: bool) { ├─╯ ○ ff36dc55760e descr_for_trunk1 trunk1 ◆ 000000000000 - "###); + "); } // Fetch all bookmarks @@ -1687,15 +1659,15 @@ fn test_git_fetch_removed_parent_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: a1@origin [new] tracked bookmark: a2@origin [new] tracked bookmark: b@origin [new] tracked bookmark: trunk1@origin [new] tracked - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ c7d4bdcbc215 descr_for_b b │ │ ○ decaa3966c83 descr_for_a2 a2 @@ -1705,7 +1677,7 @@ fn test_git_fetch_removed_parent_bookmark(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 trunk1 ├─╯ ◆ 000000000000 - "#); + "); } // Remove all bookmarks in origin. @@ -1724,15 +1696,15 @@ fn test_git_fetch_removed_parent_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" bookmark: a1@origin [deleted] untracked bookmark: trunk1@origin [deleted] untracked Abandoned 1 commits that are no longer reachable. Warning: No branch matching `master` found on any specified/configured remote - "###); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &target_jj_repo_path), @r" @ 230dd059e1b0 │ ○ c7d4bdcbc215 descr_for_b b │ │ ○ decaa3966c83 descr_for_a2 a2 @@ -1740,7 +1712,7 @@ fn test_git_fetch_removed_parent_bookmark(subprocess: bool) { │ ○ ff36dc55760e descr_for_trunk1 ├─╯ ◆ 000000000000 - "#); + "); } } @@ -1785,10 +1757,10 @@ fn test_git_fetch_remote_only_bookmark(subprocess: bool) { test_env.add_config("git.auto-local-bookmark = true"); test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message - "###); + "); } git_repo @@ -1806,19 +1778,19 @@ fn test_git_fetch_remote_only_bookmark(subprocess: bool) { test_env.add_config("git.auto-local-bookmark = false"); test_env.jj_cmd_ok(&repo_path, &["git", "fetch", "--remote=origin"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ 230dd059e1b0 │ ◆ 9f01a0e04879 message feature1 feature2@origin ├─╯ ◆ 000000000000 - "#); + "); } insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" feature1: mzyxwzks 9f01a0e0 message @origin: mzyxwzks 9f01a0e0 message feature2@origin: mzyxwzks 9f01a0e0 message - "###); + "); } } diff --git a/cli/tests/test_git_import_export.rs b/cli/tests/test_git_import_export.rs index a8b88fd1dc..f7c71c99ed 100644 --- a/cli/tests/test_git_import_export.rs +++ b/cli/tests/test_git_import_export.rs @@ -32,10 +32,10 @@ fn test_resolution_of_git_tracking_bookmarks() { insta::assert_snapshot!(stderr, @""); // Move the local bookmark somewhere else test_env.jj_cmd_ok(&repo_path, &["describe", "-r", "main", "-m", "new_message"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" main: qpvuntsm b61d21b6 (empty) new_message @git (ahead by 1 commits, behind by 1 commits): qpvuntsm hidden 03757d22 (empty) old_message - "###); + "); // Test that we can address both revisions let query = |expr| { @@ -45,12 +45,8 @@ fn test_resolution_of_git_tracking_bookmarks() { &["log", "-r", expr, "-T", template, "--no-graph"], ) }; - insta::assert_snapshot!(query("main"), @r###" - b61d21b660c17a7191f3f73873bfe7d3f7938628 new_message - "###); - insta::assert_snapshot!(query("main@git"), @r###" - 03757d2212d89990ec158e97795b612a38446652 old_message - "###); + insta::assert_snapshot!(query("main"), @"b61d21b660c17a7191f3f73873bfe7d3f7938628 new_message"); + insta::assert_snapshot!(query("main@git"), @"03757d2212d89990ec158e97795b612a38446652 old_message"); // Can't be selected by remote_bookmarks() insta::assert_snapshot!(query(r#"remote_bookmarks(exact:"main", exact:"git")"#), @""); } @@ -66,13 +62,13 @@ fn test_git_export_conflicting_git_refs() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); insta::assert_snapshot!(stdout, @""); insta::with_settings!({filters => vec![("Failed to set: .*", "Failed to set: ...")]}, { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Warning: Failed to export some bookmarks: main/sub: Failed to set: ... Hint: Git doesn't allow a branch name that looks like a parent directory of another (e.g. `foo` and `foo/bar`). Try to rename the bookmarks that failed to export or their "parent" bookmarks. - "###); + "#); }); } @@ -84,26 +80,22 @@ fn test_git_export_undo() { let git_repo = git2::Repository::open(repo_path.join(".jj/repo/store/git")).unwrap(); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "a"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" - a: qpvuntsm 230dd059 (empty) (no description set) - "###); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @"a: qpvuntsm 230dd059 (empty) (no description set)"); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); - insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-ra@git"]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-ra@git"]), @r" @ qpvuntsm test.user@example.com 2001-02-03 08:05:07 a 230dd059 │ (empty) (no description set) ~ - "###); + "); // Exported refs won't be removed by undoing the export, but the git-tracking // bookmark is. This is the same as remote-tracking bookmarks. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "undo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" - Undid operation: b27a68390bea (2001-02-03 08:05:10) export git refs - "#); - insta::assert_debug_snapshot!(get_git_repo_refs(&git_repo), @r###" + insta::assert_snapshot!(stderr, @"Undid operation: b27a68390bea (2001-02-03 08:05:10) export git refs"); + insta::assert_debug_snapshot!(get_git_repo_refs(&git_repo), @r#" [ ( "refs/heads/a", @@ -112,7 +104,7 @@ 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`? @@ -122,11 +114,11 @@ fn test_git_export_undo() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); - insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-ra@git"]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["log", "-ra@git"]), @r" @ qpvuntsm test.user@example.com 2001-02-03 08:05:07 a 230dd059 │ (empty) (no description set) ~ - "###); + "); } #[test] @@ -150,31 +142,25 @@ fn test_git_import_undo() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - bookmark: a [new] tracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"bookmark: a [new] tracked"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" a: qpvuntsm 230dd059 (empty) (no description set) @git: qpvuntsm 230dd059 (empty) (no description set) - "###); + "); // "git import" can be undone by default. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "restore", &base_operation_id]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" - Restored to operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default' - "#); + insta::assert_snapshot!(stderr, @"Restored to operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default'"); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @""); // Try "git import" again, which should re-import the bookmark "a". let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - bookmark: a [new] tracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"bookmark: a [new] tracked"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" a: qpvuntsm 230dd059 (empty) (no description set) @git: qpvuntsm 230dd059 (empty) (no description set) - "###); + "); } #[test] @@ -199,41 +185,39 @@ fn test_git_import_move_export_with_default_undo() { let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - bookmark: a [new] tracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"bookmark: a [new] tracked"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" a: qpvuntsm 230dd059 (empty) (no description set) @git: qpvuntsm 230dd059 (empty) (no description set) - "###); + "); // Move bookmark "a" and export to git repo test_env.jj_cmd_ok(&repo_path, &["new"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "a"]); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" a: yqosqzyt 096dc80d (empty) (no description set) @git (behind by 1 commits): qpvuntsm 230dd059 (empty) (no description set) - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "export"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" a: yqosqzyt 096dc80d (empty) (no description set) @git: yqosqzyt 096dc80d (empty) (no description set) - "###); + "); // "git import" can be undone with the default `restore` behavior, as shown in // the previous test. However, "git export" can't: the bookmarks in the git // repo stay where they were. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["op", "restore", &base_operation_id]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Restored to operation: eac759b9ab75 (2001-02-03 08:05:07) add workspace 'default' Working copy now at: qpvuntsm 230dd059 (empty) (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set) - "#); + "); insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @""); - insta::assert_debug_snapshot!(get_git_repo_refs(&git_repo), @r###" + insta::assert_debug_snapshot!(get_git_repo_refs(&git_repo), @r#" [ ( "refs/heads/a", @@ -242,19 +226,17 @@ fn test_git_import_move_export_with_default_undo() { ), ), ] - "###); + "#); // The last bookmark "a" state is imported from git. No idea what's the most // intuitive result here. let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "import"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - bookmark: a [new] tracked - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r###" + insta::assert_snapshot!(stderr, @"bookmark: a [new] tracked"); + insta::assert_snapshot!(get_bookmark_output(&test_env, &repo_path), @r" a: yqosqzyt 096dc80d (empty) (no description set) @git: yqosqzyt 096dc80d (empty) (no description set) - "###); + "); } fn get_bookmark_output(test_env: &TestEnvironment, repo_path: &Path) -> String { diff --git a/cli/tests/test_git_init.rs b/cli/tests/test_git_init.rs index b81decce86..28247c9316 100644 --- a/cli/tests/test_git_init.rs +++ b/cli/tests/test_git_init.rs @@ -89,9 +89,7 @@ fn test_git_init_internal() { let test_env = TestEnvironment::default(); let (stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "repo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Initialized repo in "repo" - "###); + insta::assert_snapshot!(stderr, @r#"Initialized repo in "repo""#); let workspace_root = test_env.env_root().join("repo"); let jj_path = workspace_root.join(".jj"); @@ -115,9 +113,7 @@ fn test_git_init_internal_ignore_working_copy() { let stderr = test_env.jj_cmd_cli_error(&workspace_root, &["git", "init", "--ignore-working-copy"]); - insta::assert_snapshot!(stderr, @r###" - Error: --ignore-working-copy is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --ignore-working-copy is not respected"); } #[test] @@ -127,9 +123,7 @@ fn test_git_init_internal_at_operation() { std::fs::create_dir(&workspace_root).unwrap(); let stderr = test_env.jj_cmd_cli_error(&workspace_root, &["git", "init", "--at-op=@-"]); - insta::assert_snapshot!(stderr, @r###" - Error: --at-op is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --at-op is not respected"); } #[test_case(false; "full")] @@ -178,11 +172,11 @@ fn test_git_init_external(bare: bool) { // Check that the Git repo's HEAD got checked out insta::allow_duplicates! { - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ f6950fc115ae ○ 8d698d4a8ee1 my-bookmark git_head() My commit message ◆ 000000000000 - "#); + "); } } @@ -241,9 +235,7 @@ fn test_git_init_external_import_trunk(bare: bool) { &["config", "list", "--repo", "revset-aliases.\"trunk()\""], ); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r###" - revset-aliases."trunk()" = "trunk@origin" - "###); + insta::assert_snapshot!(stdout, @r#"revset-aliases."trunk()" = "trunk@origin""#); } } @@ -267,9 +259,7 @@ fn test_git_init_external_ignore_working_copy() { git_repo_path.to_str().unwrap(), ], ); - insta::assert_snapshot!(stderr, @r###" - Error: --ignore-working-copy is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --ignore-working-copy is not respected"); } #[test] @@ -290,9 +280,7 @@ fn test_git_init_external_at_operation() { git_repo_path.to_str().unwrap(), ], ); - insta::assert_snapshot!(stderr, @r###" - Error: --at-op is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --at-op is not respected"); } #[test] @@ -302,11 +290,11 @@ fn test_git_init_external_non_existent_directory() { test_env.env_root(), &["git", "init", "repo", "--git-repo", "non-existent"], ); - insta::assert_snapshot!(strip_last_line(&stderr), @r###" + insta::assert_snapshot!(strip_last_line(&stderr), @r" Error: Failed to access the repository Caused by: 1: Cannot access $TEST_ENV/non-existent - "###); + "); } #[test] @@ -318,13 +306,13 @@ fn test_git_init_external_non_existent_git_directory() { &["git", "init", "repo", "--git-repo", "repo"], ); - insta::assert_snapshot!(&stderr, @r###" + insta::assert_snapshot!(&stderr, @r#" Error: Failed to access the repository Caused by: 1: Failed to open git repository 2: "$TEST_ENV/repo" does not appear to be a git repository 3: Missing HEAD at '.git/HEAD' - "###); + "#); let jj_path = workspace_root.join(".jj"); assert!(!jj_path.exists()); } @@ -336,10 +324,10 @@ fn test_git_init_colocated_via_git_repo_path() { init_git_repo(&workspace_root, false); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Initialized repo in "." - "###); + "#); let jj_path = workspace_root.join(".jj"); let repo_path = jj_path.join("repo"); @@ -354,20 +342,20 @@ fn test_git_init_colocated_via_git_repo_path() { .ends_with("../../../.git")); // Check that the Git repo's HEAD got checked out - insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &repo_path), @r" @ f61b77cd4bb5 ○ 8d698d4a8ee1 my-bookmark git_head() My commit message ◆ 000000000000 - "#); + "); // Check that the Git repo's HEAD moves test_env.jj_cmd_ok(&workspace_root, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f1c7aa7c62d8 ○ f61b77cd4bb5 git_head() ○ 8d698d4a8ee1 my-bookmark My commit message ◆ 000000000000 - "#); + "); } #[test] @@ -383,27 +371,27 @@ fn test_git_init_colocated_via_git_repo_path_gitlink() { assert!(workspace_root.join(".git").is_file()); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Initialized repo in "." - "###); + "#); insta::assert_snapshot!(read_git_target(&workspace_root), @"../../../.git"); // Check that the Git repo's HEAD got checked out - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f61b77cd4bb5 ○ 8d698d4a8ee1 my-bookmark git_head() My commit message ◆ 000000000000 - "#); + "); // Check that the Git repo's HEAD moves test_env.jj_cmd_ok(&workspace_root, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f1c7aa7c62d8 ○ f61b77cd4bb5 git_head() ○ 8d698d4a8ee1 my-bookmark My commit message ◆ 000000000000 - "#); + "); } #[cfg(unix)] @@ -418,27 +406,27 @@ fn test_git_init_colocated_via_git_repo_path_symlink_directory() { std::os::unix::fs::symlink(git_repo_path.join(".git"), workspace_root.join(".git")).unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Initialized repo in "." - "###); + "#); insta::assert_snapshot!(read_git_target(&workspace_root), @"../../../.git"); // Check that the Git repo's HEAD got checked out - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f61b77cd4bb5 ○ 8d698d4a8ee1 my-bookmark git_head() My commit message ◆ 000000000000 - "#); + "); // Check that the Git repo's HEAD moves test_env.jj_cmd_ok(&workspace_root, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f1c7aa7c62d8 ○ f61b77cd4bb5 git_head() ○ 8d698d4a8ee1 my-bookmark My commit message ◆ 000000000000 - "#); + "); } #[cfg(unix)] @@ -456,27 +444,27 @@ fn test_git_init_colocated_via_git_repo_path_symlink_directory_without_bare_conf std::os::unix::fs::symlink(&git_repo_path, workspace_root.join(".git")).unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Initialized repo in "." - "###); + "#); insta::assert_snapshot!(read_git_target(&workspace_root), @"../../../.git"); // Check that the Git repo's HEAD got checked out - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f61b77cd4bb5 ○ 8d698d4a8ee1 my-bookmark git_head() My commit message ◆ 000000000000 - "#); + "); // Check that the Git repo's HEAD moves test_env.jj_cmd_ok(&workspace_root, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f1c7aa7c62d8 ○ f61b77cd4bb5 git_head() ○ 8d698d4a8ee1 my-bookmark My commit message ◆ 000000000000 - "#); + "); } #[cfg(unix)] @@ -496,27 +484,27 @@ fn test_git_init_colocated_via_git_repo_path_symlink_gitlink() { std::os::unix::fs::symlink(git_workdir_path.join(".git"), workspace_root.join(".git")).unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Initialized repo in "." - "###); + "#); insta::assert_snapshot!(read_git_target(&workspace_root), @"../../../.git"); // Check that the Git repo's HEAD got checked out - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f61b77cd4bb5 ○ 8d698d4a8ee1 my-bookmark git_head() My commit message ◆ 000000000000 - "#); + "); // Check that the Git repo's HEAD moves test_env.jj_cmd_ok(&workspace_root, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f1c7aa7c62d8 ○ f61b77cd4bb5 git_head() ○ 8d698d4a8ee1 my-bookmark My commit message ◆ 000000000000 - "#); + "); } #[test] @@ -555,37 +543,37 @@ fn test_git_init_colocated_via_git_repo_path_imported_refs() { let local_path = test_env.env_root().join("local1"); set_up_local_repo(&local_path); let (_stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["git", "init", "--git-repo=."]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Initialized repo in "." - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &local_path), @r###" + "#); + insta::assert_snapshot!(get_bookmark_output(&test_env, &local_path), @r" local-remote: vvkvtnvv 230dd059 (empty) (no description set) @git: vvkvtnvv 230dd059 (empty) (no description set) @origin: vvkvtnvv 230dd059 (empty) (no description set) remote-only: vvkvtnvv 230dd059 (empty) (no description set) @git: vvkvtnvv 230dd059 (empty) (no description set) @origin: vvkvtnvv 230dd059 (empty) (no description set) - "###); + "); // With git.auto-local-bookmark = false test_env.add_config("git.auto-local-bookmark = false"); let local_path = test_env.env_root().join("local2"); set_up_local_repo(&local_path); let (_stdout, stderr) = test_env.jj_cmd_ok(&local_path, &["git", "init", "--git-repo=."]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Hint: The following remote bookmarks aren't associated with the existing local bookmarks: local-remote@origin Hint: Run `jj bookmark track local-remote@origin` to keep local bookmarks updated on future pulls. Initialized repo in "." - "###); - insta::assert_snapshot!(get_bookmark_output(&test_env, &local_path), @r###" + "#); + insta::assert_snapshot!(get_bookmark_output(&test_env, &local_path), @r" local-remote: vvkvtnvv 230dd059 (empty) (no description set) @git: vvkvtnvv 230dd059 (empty) (no description set) local-remote@origin: vvkvtnvv 230dd059 (empty) (no description set) remote-only@origin: vvkvtnvv 230dd059 (empty) (no description set) - "###); + "); } #[test] @@ -611,22 +599,22 @@ fn test_git_init_colocated_dirty_working_copy() { add_file_to_index("some-file", "new content"); add_file_to_index("new-staged-file", "new content"); std::fs::write(workspace_root.join("unstaged-file"), "new content").unwrap(); - insta::assert_snapshot!(get_git_statuses(), @r###" + insta::assert_snapshot!(get_git_statuses(), @r" Status(INDEX_NEW) new-staged-file Status(INDEX_MODIFIED) some-file Status(WT_NEW) unstaged-file - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "init", "--git-repo", "."]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Initialized repo in "." - "###); + "#); // Working-copy changes should have been snapshotted. let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-s", "--ignore-working-copy"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ sqpuoqvx test.user@example.com 2001-02-03 08:05:07 cd1e144d │ (no description set) │ C {some-file => new-staged-file} @@ -636,20 +624,20 @@ fn test_git_init_colocated_dirty_working_copy() { │ My commit message │ A some-file ◆ zzzzzzzz root() 00000000 - "#); + "); // Git index should be consistent with the working copy parent. With the // current implementation, the index is unchanged. Since jj created new // working copy commit, it's also okay to update the index reflecting the // working copy commit or the working copy parent. - insta::assert_snapshot!(get_git_statuses(), @r###" + insta::assert_snapshot!(get_git_statuses(), @r" Status(IGNORED) .jj/.gitignore Status(IGNORED) .jj/repo/ Status(IGNORED) .jj/working_copy/ Status(INDEX_NEW) new-staged-file Status(INDEX_MODIFIED) some-file Status(WT_NEW) unstaged-file - "###); + "); } #[test] @@ -663,9 +651,7 @@ fn test_git_init_colocated_ignore_working_copy() { &workspace_root, &["git", "init", "--ignore-working-copy", "--colocate"], ); - insta::assert_snapshot!(stderr, @r###" - Error: --ignore-working-copy is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --ignore-working-copy is not respected"); } #[test] @@ -678,9 +664,7 @@ fn test_git_init_colocated_at_operation() { &workspace_root, &["git", "init", "--at-op=@-", "--colocate"], ); - insta::assert_snapshot!(stderr, @r###" - Error: --at-op is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --at-op is not respected"); } #[test] @@ -695,23 +679,21 @@ fn test_git_init_external_but_git_dir_exists() { &["git", "init", "--git-repo", git_repo_path.to_str().unwrap()], ); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Initialized repo in "." - "###); + insta::assert_snapshot!(stderr, @r#"Initialized repo in ".""#); // The local ".git" repository is unrelated, so no commits should be imported - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 230dd059e1b0 ◆ 000000000000 - "###); + "); // Check that Git HEAD is not set because this isn't a colocated repo test_env.jj_cmd_ok(&workspace_root, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 4db490c88528 ○ 230dd059e1b0 ◆ 000000000000 - "###); + "); } #[test] @@ -723,26 +705,26 @@ fn test_git_init_colocated_via_flag_git_dir_exists() { let (stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "--colocate", "repo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Done importing changes from the underlying Git repo. Initialized repo in "repo" - "###); + "#); // Check that the Git repo's HEAD got checked out - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f61b77cd4bb5 ○ 8d698d4a8ee1 my-bookmark git_head() My commit message ◆ 000000000000 - "#); + "); // Check that the Git repo's HEAD moves test_env.jj_cmd_ok(&workspace_root, &["new"]); - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r#" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ f1c7aa7c62d8 ○ f61b77cd4bb5 git_head() ○ 8d698d4a8ee1 my-bookmark My commit message ◆ 000000000000 - "#); + "); } #[test] @@ -752,24 +734,22 @@ fn test_git_init_colocated_via_flag_git_dir_not_exists() { let (stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["git", "init", "--colocate", "repo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Initialized repo in "repo" - "###); + insta::assert_snapshot!(stderr, @r#"Initialized repo in "repo""#); // No HEAD ref is available yet - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 230dd059e1b0 ◆ 000000000000 - "###); + "); // Create the default bookmark (create both in case we change the default) test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "main", "master"]); // If .git/HEAD pointed to the default bookmark, new working-copy commit would // be created on top. - insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_log_output(&test_env, &workspace_root), @r" @ 230dd059e1b0 main master ◆ 000000000000 - "###); + "); } #[test] diff --git a/cli/tests/test_git_private_commits.rs b/cli/tests/test_git_private_commits.rs index 5d68e54045..41be0a314a 100644 --- a/cli/tests/test_git_private_commits.rs +++ b/cli/tests/test_git_private_commits.rs @@ -97,13 +97,13 @@ fn test_git_private_commits_block_pushing() { // May push when the commit is removed from git.private-commits test_env.add_config(r#"git.private-commits = "none()""#); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: znkkpsqq 2e1adf47 (empty) (no description set) Parent commit : yqosqzyt aa3058ff main | (empty) private 1 - "#); + "); } #[test] @@ -127,13 +127,13 @@ fn test_git_private_commits_can_be_overridden() { &workspace_root, &["git", "push", "--all", "--allow-private"], ); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: znkkpsqq 2e1adf47 (empty) (no description set) Parent commit : yqosqzyt aa3058ff main | (empty) private 1 - "#); + "); } #[test] @@ -146,13 +146,13 @@ fn test_git_private_commits_are_not_checked_if_immutable() { test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); test_env.add_config(r#"revset-aliases."immutable_heads()" = "all()""#); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark main from 7eb97bf230ad to aa3058ff8663 Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: yostqsxw dce4a15c (empty) (no description set) Parent commit : yqosqzyt aa3058ff main | (empty) private 1 - "#); + "); } #[test] @@ -187,10 +187,10 @@ fn test_git_private_commits_descending_from_commits_pushed_do_not_block_pushing( test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark main from 7eb97bf230ad to 05ef53bc99ec - "#); + "); } #[test] @@ -212,14 +212,14 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() { &workspace_root, &["git", "push", "--allow-new", "-b=main", "-b=bookmark1"], ); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark main from 7eb97bf230ad to fbb352762352 Add bookmark bookmark1 to 7eb97bf230ad Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: kpqxywon a7b08364 (empty) (no description set) Parent commit : yostqsxw fbb35276 main | (empty) public 3 - "#); + "); test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); @@ -229,10 +229,10 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() { &["bookmark", "set", "bookmark1", "-r=main"], ); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark bookmark1 from 7eb97bf230ad to fbb352762352 - "#); + "); // Ensure that the already-pushed commit doesn't block a new bookmark from // being pushed @@ -245,10 +245,10 @@ fn test_git_private_commits_already_on_the_remote_do_not_block_push() { &workspace_root, &["git", "push", "--allow-new", "-b=bookmark2"], ); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark bookmark2 to ee5b808b0b95 - "#); + "); } #[test] @@ -263,10 +263,10 @@ fn test_git_private_commits_are_evaluated_separately_for_each_remote() { test_env.jj_cmd_ok(&workspace_root, &["new", "-m=public 3"]); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "set", "main"]); let (_, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-b=main"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark main from 7eb97bf230ad to d8632ce893ab - "#); + "); test_env.add_config(r#"git.private-commits = "description(glob:'private*')""#); diff --git a/cli/tests/test_git_push.rs b/cli/tests/test_git_push.rs index de4ce82708..f89510ccf1 100644 --- a/cli/tests/test_git_push.rs +++ b/cli/tests/test_git_push.rs @@ -58,12 +58,12 @@ fn test_git_push_nothing(subprocess: bool) { } // Show the setup. `insta` has trouble if this is done inside `set_up()` insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1: xtvrqkyv d13ecdbd (empty) description 1 @origin: xtvrqkyv d13ecdbd (empty) description 1 bookmark2: rlzusymt 8476341e (empty) description 2 @origin: rlzusymt 8476341e (empty) description 2 - "###); + "); } // No bookmarks to push yet let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); @@ -71,9 +71,7 @@ fn test_git_push_nothing(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); } } @@ -97,13 +95,13 @@ fn test_git_push_current_bookmark(subprocess: bool) { test_env.jj_cmd_ok(&workspace_root, &["describe", "-m", "foo"]); // Check the setup insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1: xtvrqkyv 0f8dc656 (empty) modified bookmark1 commit @origin (ahead by 1 commits, behind by 1 commits): xtvrqkyv hidden d13ecdbd (empty) description 1 bookmark2: yostqsxw bc7610b6 (empty) foo @origin (behind by 1 commits): rlzusymt 8476341e (empty) description 2 my-bookmark: yostqsxw bc7610b6 (empty) foo - "###); + "); } // First dry-run. `bookmark1` should not get pushed. let (stdout, stderr) = test_env.jj_cmd_ok( @@ -114,12 +112,12 @@ fn test_git_push_current_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark bookmark2 from 8476341eb395 to bc7610b65a91 Add bookmark my-bookmark to bc7610b65a91 Dry-run requested, not pushing. - "#); + "); } let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--allow-new"]); insta::allow_duplicates! { @@ -159,10 +157,10 @@ fn test_git_push_current_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No bookmarks found in the default push revset: remote_bookmarks(remote=origin)..@ Nothing changed. - "###); + "); } // We can move a bookmark backwards let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-bbookmark2"]); @@ -170,10 +168,10 @@ fn test_git_push_current_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move backward bookmark bookmark2 from bc7610b65a91 to 8476341eb395 - "#); + "); } } @@ -197,10 +195,10 @@ fn test_git_push_parent_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move sideways bookmark bookmark1 from d13ecdbda2a2 to e612d524a5c6 - "#); + "); } } @@ -217,10 +215,10 @@ fn test_git_push_no_matching_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No bookmarks found in the default push revset: remote_bookmarks(remote=origin)..@ Nothing changed. - "###); + "); } } @@ -237,10 +235,10 @@ fn test_git_push_matching_bookmark_unchanged(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No bookmarks found in the default push revset: remote_bookmarks(remote=origin)..@ Nothing changed. - "###); + "); } } @@ -281,10 +279,10 @@ fn test_git_push_other_remote_has_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move sideways bookmark bookmark1 from d13ecdbda2a2 to a657f1b61b94 - "#); + "); } // Since it's already pushed to origin, nothing will happen if push again let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); @@ -292,10 +290,10 @@ fn test_git_push_other_remote_has_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No bookmarks found in the default push revset: remote_bookmarks(remote=origin)..@ Nothing changed. - "###); + "); } // The bookmark was moved on the "other" remote as well (since it's actually the // same remote), but `jj` is not aware of that since it thinks this is a @@ -313,10 +311,10 @@ fn test_git_push_other_remote_has_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to other: Add bookmark bookmark1 to a657f1b61b94 - "#); + "); } } @@ -343,12 +341,12 @@ fn test_git_push_forward_unexpectedly_moved(subprocess: bool) { // Pushing should fail let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark bookmark1 from d13ecdbda2a2 to 6750425ff51c Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. - "#); + "); } } @@ -366,12 +364,12 @@ fn test_git_push_sideways_unexpectedly_moved(subprocess: bool) { std::fs::write(origin_path.join("remote"), "remote").unwrap(); test_env.jj_cmd_ok(&origin_path, &["bookmark", "set", "bookmark1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &origin_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &origin_path), @r" bookmark1: vruxwmqv 80284bec remote @git (behind by 1 commits): qpvuntsm d13ecdbd (empty) description 1 bookmark2: zsuskuln 8476341e (empty) description 2 @git: zsuskuln 8476341e (empty) description 2 - "###); + "); } test_env.jj_cmd_ok(&origin_path, &["git", "export"]); @@ -383,22 +381,22 @@ fn test_git_push_sideways_unexpectedly_moved(subprocess: bool) { &["bookmark", "set", "bookmark1", "--allow-backwards"], ); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1: kmkuslsw 0f8bf988 local @origin (ahead by 1 commits, behind by 1 commits): xtvrqkyv d13ecdbd (empty) description 1 bookmark2: rlzusymt 8476341e (empty) description 2 @origin: rlzusymt 8476341e (empty) description 2 - "###); + "); } let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move sideways bookmark bookmark1 from d13ecdbda2a2 to 0f8bf988588e Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. - "#); + "); } } @@ -418,35 +416,35 @@ fn test_git_push_deletion_unexpectedly_moved(subprocess: bool) { std::fs::write(origin_path.join("remote"), "remote").unwrap(); test_env.jj_cmd_ok(&origin_path, &["bookmark", "set", "bookmark1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &origin_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &origin_path), @r" bookmark1: vruxwmqv 80284bec remote @git (behind by 1 commits): qpvuntsm d13ecdbd (empty) description 1 bookmark2: zsuskuln 8476341e (empty) description 2 @git: zsuskuln 8476341e (empty) description 2 - "###); + "); } test_env.jj_cmd_ok(&origin_path, &["git", "export"]); // Delete bookmark1 locally test_env.jj_cmd_ok(&workspace_root, &["bookmark", "delete", "bookmark1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1 (deleted) @origin: xtvrqkyv d13ecdbd (empty) description 1 bookmark2: rlzusymt 8476341e (empty) description 2 @origin: rlzusymt 8476341e (empty) description 2 - "###); + "); } let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--bookmark", "bookmark1"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. - "#); + "); } } @@ -462,12 +460,12 @@ fn test_git_push_unexpectedly_deleted(subprocess: bool) { let origin_path = test_env.env_root().join("origin"); test_env.jj_cmd_ok(&origin_path, &["bookmark", "delete", "bookmark1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &origin_path), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &origin_path), @r" bookmark1 (deleted) @git: qpvuntsm d13ecdbd (empty) description 1 bookmark2: zsuskuln 8476341e (empty) description 2 @git: zsuskuln 8476341e (empty) description 2 - "###); + "); } test_env.jj_cmd_ok(&origin_path, &["git", "export"]); @@ -479,33 +477,33 @@ fn test_git_push_unexpectedly_deleted(subprocess: bool) { &["bookmark", "set", "bookmark1", "--allow-backwards"], ); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1: kpqxywon 1ebe27ba local @origin (ahead by 1 commits, behind by 1 commits): xtvrqkyv d13ecdbd (empty) description 1 bookmark2: rlzusymt 8476341e (empty) description 2 @origin: rlzusymt 8476341e (empty) description 2 - "###); + "); } // Pushing a moved bookmark fails if deleted on remote let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move sideways bookmark bookmark1 from d13ecdbda2a2 to 1ebe27ba04bf Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. - "#); + "); } test_env.jj_cmd_ok(&workspace_root, &["bookmark", "delete", "bookmark1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1 (deleted) @origin: xtvrqkyv d13ecdbd (empty) description 1 bookmark2: rlzusymt 8476341e (empty) description 2 @origin: rlzusymt 8476341e (empty) description 2 - "###); + "); } if subprocess { @@ -523,10 +521,10 @@ fn test_git_push_unexpectedly_deleted(subprocess: bool) { // bookmark1@origin to exist and point somewhere. let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "-bbookmark1"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 - "#); + "); } } @@ -546,21 +544,21 @@ fn test_git_push_creation_unexpectedly_already_exists(subprocess: bool) { std::fs::write(workspace_root.join("local"), "local").unwrap(); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "bookmark1"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1: yostqsxw cb17dcdc new bookmark1 bookmark2: rlzusymt 8476341e (empty) description 2 @origin: rlzusymt 8476341e (empty) description 2 - "###); + "); } let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--allow-new"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark bookmark1 to cb17dcdc74d5 Error: Refusing to push a bookmark that unexpectedly moved on the remote. Affected refs: refs/heads/bookmark1 Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again. - "#); + "); } } @@ -602,10 +600,10 @@ fn test_git_push_locally_created_and_rewritten(subprocess: bool) { &["git", "push", "--config=git.push-new-bookmarks=true"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark my to fcc999921ce9 - "#); + "); } // Rewrite it and push again, which would fail if the pushed bookmark weren't @@ -646,13 +644,13 @@ fn test_git_push_multiple(subprocess: bool) { test_env.jj_cmd_ok(&workspace_root, &["describe", "-m", "foo"]); // Check the setup insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1 (deleted) @origin: xtvrqkyv d13ecdbd (empty) description 1 bookmark2: yqosqzyt c4a3c310 (empty) foo @origin (ahead by 1 commits, behind by 1 commits): rlzusymt 8476341e (empty) description 2 my-bookmark: yqosqzyt c4a3c310 (empty) foo - "###); + "); } // First dry-run let (stdout, stderr) = @@ -661,13 +659,13 @@ fn test_git_push_multiple(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92 Add bookmark my-bookmark to c4a3c3105d92 Dry-run requested, not pushing. - "#); + "); } // Dry run requesting two specific bookmarks let (stdout, stderr) = test_env.jj_cmd_ok( @@ -685,12 +683,12 @@ fn test_git_push_multiple(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Add bookmark my-bookmark to c4a3c3105d92 Dry-run requested, not pushing. - "#); + "); } // Dry run requesting two specific bookmarks twice let (stdout, stderr) = test_env.jj_cmd_ok( @@ -710,12 +708,12 @@ fn test_git_push_multiple(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Add bookmark my-bookmark to c4a3c3105d92 Dry-run requested, not pushing. - "#); + "); } // Dry run with glob pattern let (stdout, stderr) = test_env.jj_cmd_ok( @@ -726,29 +724,25 @@ fn test_git_push_multiple(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 Move sideways bookmark bookmark2 from 8476341eb395 to c4a3c3105d92 Dry-run requested, not pushing. - "#); + "); } // Unmatched bookmark name is error let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "-b=foo"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: No such bookmark: foo - "###); + insta::assert_snapshot!(stderr, @"Error: No such bookmark: foo"); } let stderr = test_env.jj_cmd_failure( &workspace_root, &["git", "push", "-b=foo", "-b=glob:?bookmark"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: No matching bookmarks for patterns: foo, ?bookmark - "###); + insta::assert_snapshot!(stderr, @"Error: No matching bookmarks for patterns: foo, ?bookmark"); } let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); @@ -771,7 +765,7 @@ fn test_git_push_multiple(subprocess: bool) { } let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-rall()"]); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ yqosqzyt test.user@example.com 2001-02-03 08:05:17 bookmark2 my-bookmark c4a3c310 │ (empty) foo │ ○ rlzusymt test.user@example.com 2001-02-03 08:05:10 8476341e @@ -779,7 +773,7 @@ fn test_git_push_multiple(subprocess: bool) { │ ○ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 d13ecdbd ├─╯ (empty) description 1 ◆ zzzzzzzz root() 00000000 - "###); + "); } } @@ -800,11 +794,11 @@ fn test_git_push_changes(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Creating bookmark push-yostqsxwqrlt for revision yostqsxwqrlt Changes to push to origin: Add bookmark push-yostqsxwqrlt to cf1a53a8800a - "#); + "); } // test pushing two changes at once std::fs::write(workspace_root.join("file"), "modified2").unwrap(); @@ -824,12 +818,12 @@ fn test_git_push_changes(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Creating bookmark push-yqosqzytrlsw for revision yqosqzytrlsw Changes to push to origin: Move sideways bookmark push-yostqsxwqrlt from cf1a53a8800a to 16c169664e9f Add bookmark push-yqosqzytrlsw to a050abf4ff07 - "#); + "); } // specifying the same change twice doesn't break things std::fs::write(workspace_root.join("file"), "modified3").unwrap(); @@ -838,10 +832,10 @@ fn test_git_push_changes(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move sideways bookmark push-yostqsxwqrlt from 16c169664e9f to ef6313d50ac1 - "#); + "); } // specifying the same bookmark with --change/--bookmark doesn't break things @@ -854,10 +848,10 @@ fn test_git_push_changes(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move sideways bookmark push-yostqsxwqrlt from ef6313d50ac1 to c1e65d3a64ce - "#); + "); } // try again with --change that moves the bookmark forward @@ -874,12 +868,12 @@ fn test_git_push_changes(subprocess: bool) { ); let stdout = test_env.jj_cmd_success(&workspace_root, &["status"]); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Working copy changes: M file Working copy : yostqsxw 38cb417c bar Parent commit: yqosqzyt a050abf4 push-yostqsxwqrlt* push-yqosqzytrlsw | foo - "###); + "); } let (stdout, stderr) = test_env.jj_cmd_ok( &workspace_root, @@ -889,19 +883,19 @@ fn test_git_push_changes(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move sideways bookmark push-yostqsxwqrlt from c1e65d3a64ce to 38cb417ce3a6 - "#); + "); } let stdout = test_env.jj_cmd_success(&workspace_root, &["status"]); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Working copy changes: M file Working copy : yostqsxw 38cb417c push-yostqsxwqrlt | bar Parent commit: yqosqzyt a050abf4 push-yqosqzytrlsw | foo - "###); + "); } // Test changing `git.push-bookmark-prefix`. It causes us to push again. @@ -918,11 +912,11 @@ fn test_git_push_changes(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Creating bookmark test-yostqsxwqrlt for revision yostqsxwqrlt Changes to push to origin: Add bookmark test-yostqsxwqrlt to 38cb417ce3a6 - "#); + "); } // Test deprecation warning for `git.push-branch-prefix` @@ -971,10 +965,10 @@ fn test_git_push_revisions(subprocess: bool) { &["git", "push", "--allow-new", "-r=none()"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No bookmarks point to the specified revisions: none() Nothing changed. - "###); + "); } // Push a revision with no bookmarks let (stdout, stderr) = @@ -983,10 +977,10 @@ fn test_git_push_revisions(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: No bookmarks point to the specified revisions: @-- Nothing changed. - "###); + "); } // Push a revision with a single bookmark let (stdout, stderr) = test_env.jj_cmd_ok( @@ -997,11 +991,11 @@ fn test_git_push_revisions(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark bookmark-1 to 5f432a855e59 Dry-run requested, not pushing. - "#); + "); } // Push multiple revisions of which some have bookmarks let (stdout, stderr) = test_env.jj_cmd_ok( @@ -1012,12 +1006,12 @@ fn test_git_push_revisions(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: No bookmarks point to the specified revisions: @-- Changes to push to origin: Add bookmark bookmark-1 to 5f432a855e59 Dry-run requested, not pushing. - "#); + "); } // Push a revision with a multiple bookmarks let (stdout, stderr) = test_env.jj_cmd_ok( @@ -1028,12 +1022,12 @@ fn test_git_push_revisions(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark bookmark-2a to 84f499037f5c Add bookmark bookmark-2b to 84f499037f5c Dry-run requested, not pushing. - "#); + "); } // Repeating a commit doesn't result in repeated messages about the bookmark let (stdout, stderr) = test_env.jj_cmd_ok( @@ -1044,11 +1038,11 @@ fn test_git_push_revisions(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark bookmark-1 to 5f432a855e59 Dry-run requested, not pushing. - "#); + "); } } @@ -1103,14 +1097,14 @@ fn test_git_push_mixed(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Creating bookmark push-yqosqzytrlsw for revision yqosqzytrlsw Changes to push to origin: Add bookmark push-yqosqzytrlsw to a050abf4ff07 Add bookmark bookmark-1 to 5f432a855e59 Add bookmark bookmark-2a to 84f499037f5c Add bookmark bookmark-2b to 84f499037f5c - "#); + "); } } @@ -1137,10 +1131,10 @@ fn test_git_push_existing_long_bookmark(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark push-19b790168e73f7a73a98deae21e807c0 to a050abf4ff07 - "#); + "); } } @@ -1175,10 +1169,10 @@ fn test_git_push_conflict(subprocess: bool) { test_env.jj_cmd_ok(&workspace_root, &["describe", "-m", "third"]); let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--all"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Won't push commit e2221a796300 since it has conflicts Hint: Rejected commit: yostqsxw e2221a79 my-bookmark | (conflict) third - "###); + "); } } @@ -1259,11 +1253,11 @@ fn test_git_push_no_description_in_immutable(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark my-bookmark to ea7373507ad9 Dry-run requested, not pushing. - "#); + "); } } @@ -1360,11 +1354,11 @@ fn test_git_push_missing_author_in_immutable(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark my-bookmark to 68fdae89de4f Dry-run requested, not pushing. - "#); + "); } } @@ -1477,11 +1471,11 @@ fn test_git_push_missing_committer_in_immutable(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Add bookmark my-bookmark to c79f85e90b4a Dry-run requested, not pushing. - "#); + "); } } @@ -1499,14 +1493,14 @@ fn test_git_push_deleted(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Delete bookmark bookmark1 from d13ecdbda2a2 - "#); + "); } let stdout = test_env.jj_cmd_success(&workspace_root, &["log", "-rall()"]); insta::allow_duplicates! { - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ yqosqzyt test.user@example.com 2001-02-03 08:05:13 5b36783c │ (empty) (no description set) │ ○ rlzusymt test.user@example.com 2001-02-03 08:05:10 bookmark2 8476341e @@ -1514,16 +1508,14 @@ fn test_git_push_deleted(subprocess: bool) { │ ○ xtvrqkyv test.user@example.com 2001-02-03 08:05:08 d13ecdbd ├─╯ (empty) description 1 ◆ zzzzzzzz root() 00000000 - "#); + "); } let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--deleted"]); insta::allow_duplicates! { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); } } @@ -1552,14 +1544,14 @@ fn test_git_push_conflicting_bookmarks(subprocess: bool) { test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "bookmark2"]); test_env.jj_cmd_ok(&workspace_root, &["git", "fetch"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1: xtvrqkyv d13ecdbd (empty) description 1 @origin: xtvrqkyv d13ecdbd (empty) description 1 bookmark2 (conflicted): + yostqsxw 8e670e2d (empty) description 3 + rlzusymt 8476341e (empty) description 2 @origin (behind by 1 commits): rlzusymt 8476341e (empty) description 2 - "###); + "); } let bump_bookmark1 = || { @@ -1573,11 +1565,11 @@ fn test_git_push_conflicting_bookmarks(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Bookmark bookmark2 is conflicted Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. Nothing changed. - "###); + "); } // --bookmark should be blocked by conflicting bookmark @@ -1586,10 +1578,10 @@ fn test_git_push_conflicting_bookmarks(subprocess: bool) { &["git", "push", "--allow-new", "--bookmark", "bookmark2"], ); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Bookmark bookmark2 is conflicted Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. - "###); + "); } // --all shouldn't be blocked by conflicting bookmark @@ -1599,12 +1591,12 @@ fn test_git_push_conflicting_bookmarks(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: Bookmark bookmark2 is conflicted Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. Changes to push to origin: Move forward bookmark bookmark1 from d13ecdbda2a2 to 8df52121b022 - "#); + "); } // --revisions shouldn't be blocked by conflicting bookmark @@ -1615,12 +1607,12 @@ fn test_git_push_conflicting_bookmarks(subprocess: bool) { insta::assert_snapshot!(stdout, @""); } insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: Bookmark bookmark2 is conflicted Hint: Run `jj bookmark list` to inspect, and use `jj bookmark set` to fix it up. Changes to push to origin: Move forward bookmark bookmark1 from 8df52121b022 to 345e1f64a64d - "#); + "); } } @@ -1641,15 +1633,11 @@ fn test_git_push_deleted_untracked(subprocess: bool) { ); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--deleted"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); } let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--bookmark=bookmark1"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Error: No such bookmark: bookmark1 - "###); + insta::assert_snapshot!(stderr, @"Error: No such bookmark: bookmark1"); } } @@ -1670,13 +1658,13 @@ fn test_git_push_tracked_vs_all(subprocess: bool) { ); test_env.jj_cmd_ok(&workspace_root, &["bookmark", "create", "bookmark3"]); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1: vruxwmqv db059e3f (empty) moved bookmark1 bookmark1@origin: xtvrqkyv d13ecdbd (empty) description 1 bookmark2 (deleted) @origin: rlzusymt 8476341e (empty) description 2 bookmark3: znkkpsqq 1aa4f1f2 (empty) moved bookmark2 - "###); + "); } // At this point, only bookmark2 is still tracked. `jj git push --tracked` would @@ -1684,11 +1672,11 @@ fn test_git_push_tracked_vs_all(subprocess: bool) { let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--tracked", "--dry-run"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Delete bookmark bookmark2 from 8476341eb395 Dry-run requested, not pushing. - "#); + "); } // Untrack the last remaining tracked bookmark. @@ -1697,20 +1685,18 @@ fn test_git_push_tracked_vs_all(subprocess: bool) { &["bookmark", "untrack", "bookmark2@origin"], ); insta::allow_duplicates! { - insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r###" + insta::assert_snapshot!(get_bookmark_output(&test_env, &workspace_root), @r" bookmark1: vruxwmqv db059e3f (empty) moved bookmark1 bookmark1@origin: xtvrqkyv d13ecdbd (empty) description 1 bookmark2@origin: rlzusymt 8476341e (empty) description 2 bookmark3: znkkpsqq 1aa4f1f2 (empty) moved bookmark2 - "###); + "); } // Now, no bookmarks are tracked. --tracked does not push anything let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--tracked"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" - Nothing changed. - "###); + insta::assert_snapshot!(stderr, @"Nothing changed."); } // All bookmarks are still untracked. @@ -1731,12 +1717,12 @@ fn test_git_push_tracked_vs_all(subprocess: bool) { // bookmark2@origin` instead of showing an error here. let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--all"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: Non-tracking remote bookmark bookmark1@origin exists Hint: Run `jj bookmark track bookmark1@origin` to import the remote bookmark. Changes to push to origin: Add bookmark bookmark3 to 1aa4f1f2ef7f - "#); + "); } } @@ -1756,11 +1742,11 @@ fn test_git_push_moved_forward_untracked(subprocess: bool) { ); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--allow-new"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Non-tracking remote bookmark bookmark1@origin exists Hint: Run `jj bookmark track bookmark1@origin` to import the remote bookmark. Nothing changed. - "###); + "); } } @@ -1783,11 +1769,11 @@ fn test_git_push_moved_sideways_untracked(subprocess: bool) { ); let (_stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--allow-new"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: Non-tracking remote bookmark bookmark1@origin exists Hint: Run `jj bookmark track bookmark1@origin` to import the remote bookmark. Nothing changed. - "###); + "); } } @@ -1808,12 +1794,12 @@ fn test_git_push_to_remote_named_git(subprocess: bool) { let stderr = test_env.jj_cmd_failure(&workspace_root, &["git", "push", "--all", "--remote=git"]); insta::allow_duplicates! { - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to git: Add bookmark bookmark1 to d13ecdbda2a2 Add bookmark bookmark2 to 8476341eb395 Error: Git remote named 'git' is reserved for local Git repository - "#); + "); } } @@ -1848,7 +1834,7 @@ fn test_git_push_sign_on_push() { ); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-T", template]); // There should be no signed commits initially - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ commit which should not be signed 2 ○ commit which should not be signed 1 ○ commit to be signed 2 @@ -1857,7 +1843,7 @@ fn test_git_push_sign_on_push() { │ ○ description 1 ├─╯ ◆ - "#); + "); insta::assert_snapshot!(stderr, @""); test_env.add_config( r#" @@ -1868,14 +1854,14 @@ fn test_git_push_sign_on_push() { ); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push", "--dry-run"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Changes to push to origin: Move forward bookmark bookmark2 from 8476341eb395 to 8710e91a14a1 Dry-run requested, not pushing. - "#); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-T", template]); // There should be no signed commits after performing a dry run - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ commit which should not be signed 2 ○ commit which should not be signed 1 ○ commit to be signed 2 @@ -1884,21 +1870,21 @@ fn test_git_push_sign_on_push() { │ ○ description 1 ├─╯ ◆ - "#); + "); insta::assert_snapshot!(stderr, @""); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Updated signatures of 2 commits Rebased 2 descendant commits Changes to push to origin: Move forward bookmark bookmark2 from 8476341eb395 to a6259c482040 Working copy now at: kmkuslsw b5f47345 (empty) commit which should not be signed 2 Parent commit : kpqxywon 90df08d3 (empty) commit which should not be signed 1 - "#); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-T", template]); // Only commits which are being pushed should be signed - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ commit which should not be signed 2 ○ commit which should not be signed 1 ○ commit to be signed 2 @@ -1909,7 +1895,7 @@ fn test_git_push_sign_on_push() { │ ○ description 1 ├─╯ ◆ - "#); + "); insta::assert_snapshot!(stderr, @""); // Immutable commits should not be signed @@ -1934,15 +1920,15 @@ fn test_git_push_sign_on_push() { test_env.add_config(r#"revset-aliases."immutable_heads()" = "bookmark3""#); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["git", "push"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Warning: Refusing to create new remote bookmark bookmark3@origin Hint: Use --allow-new to push new bookmark. Use --remote to specify the remote to push to. Changes to push to origin: Move forward bookmark bookmark2 from a6259c482040 to 90df08d3d612 - "#); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["log", "-T", template, "-r", "::"]); - insta::assert_snapshot!(stdout, @r#" + insta::assert_snapshot!(stdout, @r" @ commit which should not be signed 2 ◆ commit which should not be signed 1 ◆ commit to be signed 2 @@ -1953,7 +1939,7 @@ fn test_git_push_sign_on_push() { │ ○ description 1 ├─╯ ◆ - "#); + "); insta::assert_snapshot!(stderr, @""); } diff --git a/cli/tests/test_git_remotes.rs b/cli/tests/test_git_remotes.rs index b80f832b34..2fe0975316 100644 --- a/cli/tests/test_git_remotes.rs +++ b/cli/tests/test_git_remotes.rs @@ -39,20 +39,17 @@ fn test_git_remotes() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" bar http://example.com/repo/bar foo http://example.com/repo/foo - "###); + "); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "remote", "remove", "foo"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); - insta::assert_snapshot!(stdout, @"bar http://example.com/repo/bar -"); + insta::assert_snapshot!(stdout, @"bar http://example.com/repo/bar"); let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "remove", "nonexistent"]); - insta::assert_snapshot!(stderr, @r###" - Error: No git remote named 'nonexistent' - "###); + insta::assert_snapshot!(stderr, @"Error: No git remote named 'nonexistent'"); } #[test] @@ -75,20 +72,14 @@ fn test_git_remote_add() { "http://example.com/repo/foo2", ], ); - insta::assert_snapshot!(stderr, @r###" - Error: Git remote named 'foo' already exists - "###); + insta::assert_snapshot!(stderr, @"Error: Git remote named 'foo' already exists"); let stderr = test_env.jj_cmd_failure( &repo_path, &["git", "remote", "add", "git", "http://example.com/repo/git"], ); - insta::assert_snapshot!(stderr, @r###" - Error: Git remote named 'git' is reserved for local Git repository - "###); + insta::assert_snapshot!(stderr, @"Error: Git remote named 'git' is reserved for local Git repository"); let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); - insta::assert_snapshot!(stdout, @r###" - foo http://example.com/repo/foo - "###); + insta::assert_snapshot!(stdout, @"foo http://example.com/repo/foo"); } #[test] @@ -111,9 +102,7 @@ fn test_git_remote_set_url() { "http://example.com/repo/bar", ], ); - insta::assert_snapshot!(stderr, @r###" - Error: No git remote named 'bar' - "###); + insta::assert_snapshot!(stderr, @"Error: No git remote named 'bar'"); let stderr = test_env.jj_cmd_failure( &repo_path, &[ @@ -124,9 +113,7 @@ fn test_git_remote_set_url() { "http://example.com/repo/git", ], ); - insta::assert_snapshot!(stderr, @r###" - Error: Git remote named 'git' is reserved for local Git repository - "###); + insta::assert_snapshot!(stderr, @"Error: Git remote named 'git' is reserved for local Git repository"); let (stdout, stderr) = test_env.jj_cmd_ok( &repo_path, &[ @@ -140,9 +127,7 @@ fn test_git_remote_set_url() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); - insta::assert_snapshot!(stdout, @r###" - foo http://example.com/repo/bar - "###); + insta::assert_snapshot!(stdout, @"foo http://example.com/repo/bar"); } #[test] @@ -184,26 +169,20 @@ fn test_git_remote_rename() { &["git", "remote", "add", "baz", "http://example.com/repo/baz"], ); let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "rename", "bar", "foo"]); - insta::assert_snapshot!(stderr, @r###" - Error: No git remote named 'bar' - "###); + insta::assert_snapshot!(stderr, @"Error: No git remote named 'bar'"); let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "rename", "foo", "baz"]); - insta::assert_snapshot!(stderr, @r###" - Error: Git remote named 'baz' already exists - "###); + insta::assert_snapshot!(stderr, @"Error: Git remote named 'baz' already exists"); let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "rename", "foo", "git"]); - insta::assert_snapshot!(stderr, @r###" - Error: Git remote named 'git' is reserved for local Git repository - "###); + insta::assert_snapshot!(stderr, @"Error: Git remote named 'git' is reserved for local Git repository"); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["git", "remote", "rename", "foo", "bar"]); insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" bar http://example.com/repo/foo baz http://example.com/repo/baz - "###); + "); } #[test] @@ -225,22 +204,18 @@ fn test_git_remote_named_git() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); - insta::assert_snapshot!(stdout, @r###" - bar http://example.com/repo/repo - "###); + insta::assert_snapshot!(stdout, @"bar http://example.com/repo/repo"); // @git bookmark shouldn't be renamed. let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-rmain@git", "-Tbookmarks"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ main │ ~ - "###); + "); // The remote cannot be renamed back by jj. let stderr = test_env.jj_cmd_failure(&repo_path, &["git", "remote", "rename", "bar", "git"]); - insta::assert_snapshot!(stderr, @r###" - Error: Git remote named 'git' is reserved for local Git repository - "###); + insta::assert_snapshot!(stderr, @"Error: Git remote named 'git' is reserved for local Git repository"); // Reinitialize the repo with remote named 'git'. fs::remove_dir_all(repo_path.join(".jj")).unwrap(); @@ -252,13 +227,12 @@ fn test_git_remote_named_git() { insta::assert_snapshot!(stdout, @""); insta::assert_snapshot!(stderr, @""); let stdout = test_env.jj_cmd_success(&repo_path, &["git", "remote", "list"]); - insta::assert_snapshot!(stdout, @r###" - "###); + insta::assert_snapshot!(stdout, @""); // @git bookmark shouldn't be removed. let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-rmain@git", "-Tbookmarks"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" ○ main │ ~ - "###); + "); } diff --git a/cli/tests/test_git_submodule.rs b/cli/tests/test_git_submodule.rs index acf1e97bb2..3f2c326bc4 100644 --- a/cli/tests/test_git_submodule.rs +++ b/cli/tests/test_git_submodule.rs @@ -47,19 +47,17 @@ fn test_gitsubmodule_print_gitmodules() { &workspace_root, &["git", "submodule", "print-gitmodules", "-r", "@-"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" name:old url:https://github.com/old/old.git path:old - - - "###); + "); let stdout = test_env.jj_cmd_success(&workspace_root, &["git", "submodule", "print-gitmodules"]); - insta::assert_snapshot!(stdout, @r###" - name:new - url:https://github.com/new/new.git - path:new - "###); + insta::assert_snapshot!(stdout, @r" + name:new + url:https://github.com/new/new.git + path:new + "); } diff --git a/cli/tests/test_gitignores.rs b/cli/tests/test_gitignores.rs index 5384e2e28d..18ecf9bfb9 100644 --- a/cli/tests/test_gitignores.rs +++ b/cli/tests/test_gitignores.rs @@ -57,11 +57,11 @@ fn test_gitignores() { std::fs::write(workspace_root.join("file3"), "contents").unwrap(); let stdout = test_env.jj_cmd_success(&workspace_root, &["diff", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" A .gitignore A file0 A file3 - "###); + "); } #[test] @@ -86,13 +86,9 @@ fn test_gitignores_relative_excludes_file_path() { // to the cwd. std::fs::create_dir(workspace_root.join("sub")).unwrap(); let stdout = test_env.jj_cmd_success(&workspace_root.join("sub"), &["diff", "-s"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" - A ../not-ignored - "###); + insta::assert_snapshot!(stdout.replace('\\', "/"), @"A ../not-ignored"); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["-Rrepo", "diff", "-s"]); - insta::assert_snapshot!(stdout.replace('\\', "/"), @r###" - A repo/not-ignored - "###); + insta::assert_snapshot!(stdout.replace('\\', "/"), @"A repo/not-ignored"); } #[test] @@ -118,19 +114,19 @@ fn test_gitignores_ignored_file_in_target_commit() { // Update to the commit with the "ignored" file let (stdout, stderr) = test_env.jj_cmd_ok(&workspace_root, &["edit", "with-file"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: qpvuntsm 5ada929e with-file | (no description set) Parent commit : zzzzzzzz 00000000 (empty) (no description set) Added 1 files, modified 0 files, removed 0 files Warning: 1 of those updates were skipped because there were conflicting changes in the working copy. Hint: Inspect the changes compared to the intended target with `jj diff --from 5ada929e5d2e`. Discard the conflicting changes with `jj restore --from 5ada929e5d2e`. - "###); + "); let stdout = test_env.jj_cmd_success( &workspace_root, &["diff", "--git", "--from", &target_commit_id], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/ignored b/ignored index 8a69467466..4d9be5127b 100644 --- a/ignored @@ -138,5 +134,5 @@ fn test_gitignores_ignored_file_in_target_commit() { @@ -1,1 +1,1 @@ -committed contents +contents in working copy - "###); + "); } diff --git a/cli/tests/test_global_opts.rs b/cli/tests/test_global_opts.rs index 45c547b4ca..7df99db87a 100644 --- a/cli/tests/test_global_opts.rs +++ b/cli/tests/test_global_opts.rs @@ -43,9 +43,7 @@ fn test_non_utf8_arg() { .assert() .code(2); let stderr = get_stderr_string(&assert); - insta::assert_snapshot!(stderr, @r###" - Error: Non-utf8 argument - "###); + insta::assert_snapshot!(stderr, @"Error: Non-utf8 argument"); } #[test] @@ -72,17 +70,15 @@ fn test_no_subcommand() { // Outside of a repo. let stderr = test_env.jj_cmd_failure(test_env.env_root(), &[]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Hint: Use `jj -h` for a list of available commands. Run `jj config set --user ui.default-command log` to disable this message. Error: There is no jj repo in "." - "###); + "#); test_env.add_config(r#"ui.default-command="log""#); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &[]); - insta::assert_snapshot!(stderr, @r###" - Error: There is no jj repo in "." - "###); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in ".""#); let stdout = test_env.jj_cmd_success(test_env.env_root(), &["--help"]); insta::assert_snapshot!(stdout.lines().next().unwrap(), @"Jujutsu (An experimental VCS)"); @@ -99,16 +95,16 @@ fn test_no_subcommand() { test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "log"]); test_env.jj_cmd_ok(&repo_path, &["bookmark", "create", "show"]); // TODO: test_env.jj_cmd_ok(&repo_path, &["-r", "help"]) - insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["-r", "log"]), @r###" + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["-r", "log"]), @r" @ qpvuntsm test.user@example.com 2001-02-03 08:05:07 help log show 230dd059 │ (empty) (no description set) ~ - "###); - insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["-r", "show"]), @r###" + "); + insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["-r", "show"]), @r" @ qpvuntsm test.user@example.com 2001-02-03 08:05:07 help log show 230dd059 │ (empty) (no description set) ~ - "###); + "); // Multiple default command strings work. test_env.add_config(r#"ui.default-command=["commit", "-m", "foo"]"#); @@ -116,10 +112,10 @@ fn test_no_subcommand() { std::fs::write(repo_path.join("file.txt"), "file").unwrap(); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &[]); assert_eq!(stdout, ""); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Working copy now at: kxryzmor 89c70edf (empty) (no description set) Parent commit : lylxulpl 51bd3589 foo - "###); + "); } #[test] @@ -131,10 +127,10 @@ fn test_ignore_working_copy() { std::fs::write(repo_path.join("file"), "initial").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ b15ef4cdd277d2c63cce6d67c1916f53a36141f7 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Modify the file. With --ignore-working-copy, we still get the same commit // ID. @@ -147,28 +143,24 @@ fn test_ignore_working_copy() { // But without --ignore-working-copy, we get a new commit ID. let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 4d2c49a8f8e2f1ba61f48ba79e5f4a5faa6512cf ◆ 0000000000000000000000000000000000000000 - "###); + "); } #[test] fn test_repo_arg_with_init() { let test_env = TestEnvironment::default(); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["init", "-R=.", "repo"]); - insta::assert_snapshot!(stderr, @r###" - Error: There is no jj repo in "." - "###); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in ".""#); } #[test] fn test_repo_arg_with_git_clone() { let test_env = TestEnvironment::default(); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["git", "clone", "-R=.", "remote"]); - insta::assert_snapshot!(stderr, @r###" - Error: There is no jj repo in "." - "###); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in ".""#); } #[test] @@ -181,31 +173,27 @@ fn test_resolve_workspace_directory() { // Ancestor of cwd let stdout = test_env.jj_cmd_success(&subdir, &["status"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" The working copy is clean Working copy : qpvuntsm 230dd059 (empty) (no description set) Parent commit: zzzzzzzz 00000000 (empty) (no description set) - "###); + "); // Explicit subdirectory path let stderr = test_env.jj_cmd_failure(&subdir, &["status", "-R", "."]); - insta::assert_snapshot!(stderr, @r###" - Error: There is no jj repo in "." - "###); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in ".""#); // Valid explicit path let stdout = test_env.jj_cmd_success(&subdir, &["status", "-R", "../.."]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" The working copy is clean Working copy : qpvuntsm 230dd059 (empty) (no description set) Parent commit: zzzzzzzz 00000000 (empty) (no description set) - "###); + "); // "../../..".ancestors() contains "../..", but it should never be looked up. let stderr = test_env.jj_cmd_failure(&subdir, &["status", "-R", "../../.."]); - insta::assert_snapshot!(stderr, @r###" - Error: There is no jj repo in "../../.." - "###); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in "../../..""#); } #[test] @@ -215,22 +203,18 @@ fn test_no_workspace_directory() { std::fs::create_dir(&repo_path).unwrap(); let stderr = test_env.jj_cmd_failure(&repo_path, &["status"]); - insta::assert_snapshot!(stderr, @r###" - Error: There is no jj repo in "." - "###); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in ".""#); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["status", "-R", "repo"]); - insta::assert_snapshot!(stderr, @r###" - Error: There is no jj repo in "repo" - "###); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in "repo""#); std::fs::create_dir(repo_path.join(".git")).unwrap(); let stderr = test_env.jj_cmd_failure(&repo_path, &["status"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Error: There is no jj repo in "." Hint: It looks like this is a git repo. You can create a jj repo backed by it by running this: jj git init --colocate - "###); + "#); } #[test] @@ -243,7 +227,7 @@ fn test_bad_path() { // cwd == workspace_root let stderr = test_env.jj_cmd_failure(&repo_path, &["file", "show", "../out"]); - insta::assert_snapshot!(stderr.replace('\\', "/"), @r###" + insta::assert_snapshot!(stderr.replace('\\', "/"), @r#" Error: Failed to parse fileset: Invalid file pattern Caused by: 1: --> 1:1 @@ -254,11 +238,11 @@ fn test_bad_path() { = Invalid file pattern 2: Path "../out" is not in the repo "." 3: Invalid component ".." in repo-relative path "../out" - "###); + "#); // cwd != workspace_root, can't be parsed as repo-relative path let stderr = test_env.jj_cmd_failure(&subdir, &["file", "show", "../.."]); - insta::assert_snapshot!(stderr.replace('\\', "/"), @r###" + insta::assert_snapshot!(stderr.replace('\\', "/"), @r#" Error: Failed to parse fileset: Invalid file pattern Caused by: 1: --> 1:1 @@ -269,11 +253,11 @@ fn test_bad_path() { = Invalid file pattern 2: Path "../.." is not in the repo "../" 3: Invalid component ".." in repo-relative path "../" - "###); + "#); // cwd != workspace_root, can be parsed as repo-relative path let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["file", "show", "-Rrepo", "out"]); - insta::assert_snapshot!(stderr.replace('\\', "/"), @r###" + insta::assert_snapshot!(stderr.replace('\\', "/"), @r#" Error: Failed to parse fileset: Invalid file pattern Caused by: 1: --> 1:1 @@ -285,7 +269,7 @@ fn test_bad_path() { 2: Path "out" is not in the repo "repo" 3: Invalid component ".." in repo-relative path "../out" Hint: Consider using root:"out" to specify repo-relative path - "###); + "#); } #[test] @@ -295,7 +279,7 @@ fn test_invalid_filesets_looking_like_filepaths() { let repo_path = test_env.env_root().join("repo"); let stderr = test_env.jj_cmd_failure(&repo_path, &["file", "show", "abc~"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Error: Failed to parse fileset: Syntax error Caused by: --> 1:5 | @@ -304,7 +288,7 @@ fn test_invalid_filesets_looking_like_filepaths() { | = expected `~` or Hint: See https://jj-vcs.github.io/jj/latest/filesets/ for filesets syntax, or for how to match file paths. - "#); + "); } #[test] @@ -318,43 +302,43 @@ fn test_broken_repo_structure() { // Test the error message when the git repository can't be located. std::fs::remove_file(store_path.join("git_target")).unwrap(); let stderr = test_env.jj_cmd_internal_error(&repo_path, &["log"]); - insta::assert_snapshot!(strip_last_line(&stderr), @r###" + insta::assert_snapshot!(strip_last_line(&stderr), @r" Internal error: The repository appears broken or inaccessible Caused by: 1: Cannot access $TEST_ENV/repo/.jj/repo/store/git_target - "###); + "); // Test the error message when the commit backend is of unknown type. std::fs::write(&store_type_path, "unknown").unwrap(); let stderr = test_env.jj_cmd_internal_error(&repo_path, &["log"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Internal error: This version of the jj binary doesn't support this type of repo Caused by: Unsupported commit backend type 'unknown' - "###); + "); // Test the error message when the file indicating the commit backend type // cannot be read. std::fs::remove_file(&store_type_path).unwrap(); std::fs::create_dir(&store_type_path).unwrap(); let stderr = test_env.jj_cmd_internal_error(&repo_path, &["log"]); - insta::assert_snapshot!(strip_last_line(&stderr), @r###" + insta::assert_snapshot!(strip_last_line(&stderr), @r" Internal error: The repository appears broken or inaccessible Caused by: 1: Failed to read commit backend type 2: Cannot access $TEST_ENV/repo/.jj/repo/store/type - "###); + "); // Test when the .jj directory is empty. The error message is identical to // the previous one, but writing the default type file would also fail. std::fs::remove_dir_all(repo_path.join(".jj")).unwrap(); std::fs::create_dir(repo_path.join(".jj")).unwrap(); let stderr = test_env.jj_cmd_internal_error(&repo_path, &["log"]); - insta::assert_snapshot!(strip_last_line(&stderr), @r###" + insta::assert_snapshot!(strip_last_line(&stderr), @r" Internal error: The repository appears broken or inaccessible Caused by: 1: Failed to read commit backend type 2: Cannot access $TEST_ENV/repo/.jj/repo/store/type - "###); + "); } #[test] @@ -366,42 +350,42 @@ fn test_color_config() { // Test that --color=always is respected. let stdout = test_env.jj_cmd_success(&repo_path, &["--color=always", "log", "-T", "commit_id"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Test that color is used if it's requested in the config file test_env.add_config(r#"ui.color="always""#); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Test that --color=never overrides the config. let stdout = test_env.jj_cmd_success(&repo_path, &["--color=never", "log", "-T", "commit_id"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Test that --color=auto overrides the config. let stdout = test_env.jj_cmd_success(&repo_path, &["--color=auto", "log", "-T", "commit_id"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Test that --config 'ui.color=never' overrides the config. let stdout = test_env.jj_cmd_success( &repo_path, &["--config=ui.color=never", "log", "-T", "commit_id"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // --color overrides --config 'ui.color=...'. let stdout = test_env.jj_cmd_success( @@ -415,18 +399,18 @@ fn test_color_config() { "commit_id", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Test that NO_COLOR does NOT override the request for color in the config file test_env.add_env_var("NO_COLOR", "1"); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Test that per-repo config overrides the user config. std::fs::write( @@ -435,10 +419,10 @@ fn test_color_config() { ) .unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "commit_id"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ 230dd059e1b059aefc0da06a2e5a7dbf22362f22 ◆ 0000000000000000000000000000000000000000 - "###); + "); // Invalid --color let stderr = test_env.jj_cmd_cli_error(&repo_path, &["log", "--color=foo"]); @@ -467,15 +451,15 @@ fn test_color_ui_messages() { // hint and error let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["-R."]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r#" Hint: Use `jj -h` for a list of available commands. Run `jj config set --user ui.default-command log` to disable this message. Error: There is no jj repo in "." - "###); + "#); // error source let stderr = test_env.jj_cmd_failure(&repo_path, &["log", ".."]); - insta::assert_snapshot!(stderr.replace('\\', "/"), @r###" + insta::assert_snapshot!(stderr.replace('\\', "/"), @r#" Error: Failed to parse fileset: Invalid file pattern Caused by: 1:  --> 1:1 @@ -486,13 +470,11 @@ fn test_color_ui_messages() {  = Invalid file pattern 2: Path ".." is not in the repo "." 3: Invalid component ".." in repo-relative path "../" - "###); + "#); // warning let (_stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["log", "@"]); - insta::assert_snapshot!(stderr, @r###" - Warning: The argument "@" is being interpreted as a fileset expression. To specify a revset, pass -r "@" instead. - "###); + insta::assert_snapshot!(stderr, @r#"Warning: The argument "@" is being interpreted as a fileset expression. To specify a revset, pass -r "@" instead."#); // error inlined in template output test_env.jj_cmd_ok(&repo_path, &["new"]); @@ -505,11 +487,11 @@ fn test_color_ui_messages() { "-Tdescription", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" 167f90e7600a50f85c4f909b53eaf546faa82879 <Error: No Commit available> (elided revisions) 0000000000000000000000000000000000000000 - "###); + "); // formatted hint let stderr = test_env.jj_cmd_failure(&repo_path, &["new", ".."]); @@ -523,11 +505,11 @@ fn test_color_ui_messages() { // debugging colors let (stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["st", "--color", "debug"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" The working copy is clean Working copy : <><><><><><><><><> Parent commit: <><> <><> <> <> - "###); + "); } #[test] @@ -883,36 +865,36 @@ fn test_no_user_configured() { .env_remove("JJ_USER") .assert() .success(); - insta::assert_snapshot!(get_stderr_string(&assert), @r###" + insta::assert_snapshot!(get_stderr_string(&assert), @r#" Working copy now at: qpvuntsm 7a7d6016 (empty) without name Parent commit : zzzzzzzz 00000000 (empty) (no description set) Warning: Name not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run: jj config set --user user.name "Some One" - "###); + "#); let assert = test_env .jj_cmd(&repo_path, &["describe", "-m", "without email"]) .env_remove("JJ_EMAIL") .assert() .success(); - insta::assert_snapshot!(get_stderr_string(&assert), @r###" + insta::assert_snapshot!(get_stderr_string(&assert), @r#" Working copy now at: qpvuntsm 906f8b89 (empty) without email Parent commit : zzzzzzzz 00000000 (empty) (no description set) Warning: Email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run: jj config set --user user.email "someone@example.com" - "###); + "#); let assert = test_env .jj_cmd(&repo_path, &["describe", "-m", "without name and email"]) .env_remove("JJ_USER") .env_remove("JJ_EMAIL") .assert() .success(); - insta::assert_snapshot!(get_stderr_string(&assert), @r###" + insta::assert_snapshot!(get_stderr_string(&assert), @r#" Working copy now at: qpvuntsm 57d3a489 (empty) without name and email Parent commit : zzzzzzzz 00000000 (empty) (no description set) Warning: Name and email not configured. Until configured, your commits will be created with the empty identity, and can't be pushed to remotes. To configure, run: jj config set --user user.name "Some One" jj config set --user user.email "someone@example.com" - "###); + "#); } #[test] diff --git a/cli/tests/test_help_command.rs b/cli/tests/test_help_command.rs index c416906d2f..8c0e3548ba 100644 --- a/cli/tests/test_help_command.rs +++ b/cli/tests/test_help_command.rs @@ -37,23 +37,19 @@ fn test_help() { // Help command should not work recursively let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["workspace", "help", "root"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" error: unrecognized subcommand 'help' Usage: jj workspace [OPTIONS] For more information, try '--help'. - "#); + "); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["workspace", "add", "help"]); - insta::assert_snapshot!(stderr, @r#" - Error: There is no jj repo in "." - "#); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in ".""#); let stderr = test_env.jj_cmd_failure(test_env.env_root(), &["new", "help", "main"]); - insta::assert_snapshot!(stderr, @r#" - Error: There is no jj repo in "." - "#); + insta::assert_snapshot!(stderr, @r#"Error: There is no jj repo in ".""#); // Help command should output the same as --help for nonexistent commands let help_cmd_stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "nonexistent"]); @@ -67,7 +63,7 @@ fn test_help() { assert_eq!(help_cmd_stdout, help_flag_stdout); let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "unknown"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" error: unrecognized subcommand 'unknown' tip: a similar subcommand exists: 'undo' @@ -75,14 +71,14 @@ fn test_help() { Usage: jj [OPTIONS] For more information, try '--help'. - "#); + "); let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "log", "--", "-r"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: a value is required for '--revisions ' but none was supplied For more information, try '--help'. - "###); + "); } #[test] @@ -102,38 +98,38 @@ fn test_help_keyword() { // It should give hints if a similar keyword is present let help_cmd_stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "-k", "rev"]); - insta::assert_snapshot!(help_cmd_stderr, @r###" + insta::assert_snapshot!(help_cmd_stderr, @r" error: invalid value 'rev' for '--keyword ' [possible values: bookmarks, config, filesets, glossary, revsets, templates, tutorial] tip: a similar value exists: 'revsets' For more information, try '--help'. - "###); + "); // It should give error with a hint if no similar keyword is found let help_cmd_stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "-k", ""]); - insta::assert_snapshot!(help_cmd_stderr, @r###" + insta::assert_snapshot!(help_cmd_stderr, @r" error: invalid value '' for '--keyword ' [possible values: bookmarks, config, filesets, glossary, revsets, templates, tutorial] For more information, try '--help'. - "###); + "); // The keyword flag with no argument should error with a hint let help_cmd_stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "-k"]); - insta::assert_snapshot!(help_cmd_stderr, @r###" + insta::assert_snapshot!(help_cmd_stderr, @r" error: a value is required for '--keyword ' but none was supplied [possible values: bookmarks, config, filesets, glossary, revsets, templates, tutorial] For more information, try '--help'. - "###); + "); // It shouldn't show help for a certain keyword if the `--keyword` is not // present let help_cmd_stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["help", "revsets"]); - insta::assert_snapshot!(help_cmd_stderr, @r#" + insta::assert_snapshot!(help_cmd_stderr, @r" error: unrecognized subcommand 'revsets' tip: some similar subcommands exist: 'resolve', 'prev', 'restore', 'rebase', 'revert' @@ -141,5 +137,5 @@ fn test_help_keyword() { Usage: jj [OPTIONS] For more information, try '--help'. - "#); + "); } diff --git a/cli/tests/test_immutable_commits.rs b/cli/tests/test_immutable_commits.rs index 316251b0d1..695b53de59 100644 --- a/cli/tests/test_immutable_commits.rs +++ b/cli/tests/test_immutable_commits.rs @@ -27,7 +27,7 @@ fn test_rewrite_immutable_generic() { test_env.jj_cmd_ok(&repo_path, &["new", "main-", "-m=c"]); std::fs::write(repo_path.join("file"), "c").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["log"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ mzvwutvl test.user@example.com 2001-02-03 08:05:12 7adb43e8 │ c │ ○ kkmpptxz test.user@example.com 2001-02-03 08:05:10 main 72e1b68c @@ -35,29 +35,27 @@ fn test_rewrite_immutable_generic() { ○ qpvuntsm test.user@example.com 2001-02-03 08:05:08 b84b821b │ a ◆ zzzzzzzz root() 00000000 - "###); + "); // Cannot rewrite a commit in the configured set test_env.add_config(r#"revset-aliases."immutable_heads()" = "main""#); let stderr = test_env.jj_cmd_failure(&repo_path, &["edit", "main"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Error: Commit 72e1b68cbcf2 is immutable Hint: Could not modify commit: kkmpptxz 72e1b68c main | b Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "#); + "); // Cannot rewrite an ancestor of the configured set let stderr = test_env.jj_cmd_failure(&repo_path, &["edit", "main-"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Error: Commit b84b821b8a2b is immutable Hint: Could not modify commit: qpvuntsm b84b821b a Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "#); + "); // Cannot rewrite the root commit even with an empty set of immutable commits test_env.add_config(r#"revset-aliases."immutable_heads()" = "none()""#); let stderr = test_env.jj_cmd_failure(&repo_path, &["edit", "root()"]); - insta::assert_snapshot!(stderr, @r###" - Error: The root commit 000000000000 is immutable - "###); + insta::assert_snapshot!(stderr, @"Error: The root commit 000000000000 is immutable"); // Error mutating the repo if immutable_heads() uses a ref that can't be // resolved @@ -74,37 +72,31 @@ fn test_rewrite_immutable_generic() { // Can use --ignore-immutable to override test_env.add_config(r#"revset-aliases."immutable_heads()" = "main""#); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["--ignore-immutable", "edit", "main"]); - insta::assert_snapshot!(stdout, @r###" - "###); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stdout, @""); + insta::assert_snapshot!(stderr, @r" Working copy now at: kkmpptxz 72e1b68c main | b Parent commit : qpvuntsm b84b821b a Added 0 files, modified 1 files, removed 0 files - "###); + "); // ... but not the root commit let stderr = test_env.jj_cmd_failure(&repo_path, &["--ignore-immutable", "edit", "root()"]); - insta::assert_snapshot!(stderr, @r###" - Error: The root commit 000000000000 is immutable - "###); + insta::assert_snapshot!(stderr, @"Error: The root commit 000000000000 is immutable"); // Mutating the repo works if ref is wrapped in present() test_env.add_config( r#"revset-aliases."immutable_heads()" = "present(bookmark_that_does_not_exist)""#, ); let (stdout, stderr) = test_env.jj_cmd_ok(&repo_path, &["new", "main"]); - insta::assert_snapshot!(stdout, @r###" - "###); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stdout, @""); + insta::assert_snapshot!(stderr, @r" Working copy now at: wqnwkozp fc921593 (empty) (no description set) Parent commit : kkmpptxz 72e1b68c main | b - "###); + "); // immutable_heads() of different arity doesn't shadow the 0-ary one test_env.add_config(r#"revset-aliases."immutable_heads(foo)" = "none()""#); let stderr = test_env.jj_cmd_failure(&repo_path, &["edit", "root()"]); - insta::assert_snapshot!(stderr, @r###" - Error: The root commit 000000000000 is immutable - "###); + insta::assert_snapshot!(stderr, @"Error: The root commit 000000000000 is immutable"); } #[test] @@ -115,12 +107,12 @@ fn test_new_wc_commit_when_wc_immutable() { test_env.add_config(r#"revset-aliases."immutable_heads()" = "main""#); test_env.jj_cmd_ok(test_env.env_root(), &["new", "-m=a"]); let (_, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["bookmark", "set", "main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Moved 1 bookmarks to kkmpptxz a164195b main | (empty) a Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: zsuskuln ef5fa85b (empty) (no description set) Parent commit : kkmpptxz a164195b main | (empty) a - "###); + "); } #[test] @@ -130,11 +122,11 @@ fn test_immutable_heads_set_to_working_copy() { test_env.jj_cmd_ok(test_env.env_root(), &["bookmark", "create", "main"]); test_env.add_config(r#"revset-aliases."immutable_heads()" = "@""#); let (_, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["new", "-m=a"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Working copy now at: pmmvwywv 7278b2d8 (empty) (no description set) Parent commit : kkmpptxz a713ef56 (empty) a - "###); + "); } #[test] @@ -149,16 +141,16 @@ fn test_new_wc_commit_when_wc_immutable_multi_workspace() { let workspace1_envroot = test_env.env_root().join("workspace1"); test_env.jj_cmd_ok(&workspace1_envroot, &["edit", "default@"]); let (_, stderr) = test_env.jj_cmd_ok(&repo_path, &["bookmark", "set", "main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Moved 1 bookmarks to kkmpptxz 7796c4df main | (empty) a Warning: The working-copy commit in workspace 'default' became immutable, so a new commit has been created on top of it. Warning: The working-copy commit in workspace 'workspace1' became immutable, so a new commit has been created on top of it. Working copy now at: royxmykx 896465c4 (empty) (no description set) Parent commit : kkmpptxz 7796c4df main | (empty) a - "###); + "); test_env.jj_cmd_ok(&workspace1_envroot, &["workspace", "update-stale"]); let (stdout, _) = test_env.jj_cmd_ok(&workspace1_envroot, &["log", "--no-graph"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" nppvrztz test.user@example.com 2001-02-03 08:05:11 workspace1@ ee0671fd (empty) (no description set) royxmykx test.user@example.com 2001-02-03 08:05:12 default@ 896465c4 @@ -166,7 +158,7 @@ fn test_new_wc_commit_when_wc_immutable_multi_workspace() { kkmpptxz test.user@example.com 2001-02-03 08:05:09 main 7796c4df (empty) a zzzzzzzz root() 00000000 - "###); + "); } #[test] @@ -192,7 +184,7 @@ fn test_rewrite_immutable_commands() { // Log shows mutable commits, their parents, and trunk() by default let (stdout, _stderr) = test_env.jj_cmd_ok(&repo_path, &["log"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ yqosqzyt test.user@example.com 2001-02-03 08:05:14 55641cc5 │ (no description set) │ ◆ mzvwutvl test.user@example.com 2001-02-03 08:05:12 main bcab555f conflict @@ -203,15 +195,15 @@ fn test_rewrite_immutable_commands() { ◆ kkmpptxz test.user@example.com 2001-02-03 08:05:10 72e1b68c │ b ~ - "###); + "); // abandon let stderr = test_env.jj_cmd_failure(&repo_path, &["abandon", "main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // absorb let stderr = test_env.jj_cmd_failure(&repo_path, &["absorb", "--into=::@-"]); insta::assert_snapshot!(stderr, @r" @@ -221,130 +213,130 @@ fn test_rewrite_immutable_commands() { "); // chmod let stderr = test_env.jj_cmd_failure(&repo_path, &["file", "chmod", "-r=main", "x", "file"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // describe let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // diffedit let stderr = test_env.jj_cmd_failure(&repo_path, &["diffedit", "-r=main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // edit let stderr = test_env.jj_cmd_failure(&repo_path, &["edit", "main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // new --insert-before let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "--insert-before", "main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // new --insert-after parent_of_main let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "--insert-after", "description(b)"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // parallelize let stderr = test_env.jj_cmd_failure(&repo_path, &["parallelize", "description(b)", "main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // rebase -s let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-s=main", "-d=@"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // rebase -b let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-b=main", "-d=@"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Error: Commit 77cee210cbf5 is immutable Hint: Could not modify commit: zsuskuln 77cee210 c Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "#); + "); // rebase -r let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-r=main", "-d=@"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // resolve let stderr = test_env.jj_cmd_failure(&repo_path, &["resolve", "-r=description(merge)", "file"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // restore -c let stderr = test_env.jj_cmd_failure(&repo_path, &["restore", "-c=main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // restore --into let stderr = test_env.jj_cmd_failure(&repo_path, &["restore", "--into=main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // split let stderr = test_env.jj_cmd_failure(&repo_path, &["split", "-r=main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // squash -r let stderr = test_env.jj_cmd_failure(&repo_path, &["squash", "-r=description(b)"]); - insta::assert_snapshot!(stderr, @r#" + insta::assert_snapshot!(stderr, @r" Error: Commit 72e1b68cbcf2 is immutable Hint: Could not modify commit: kkmpptxz 72e1b68c b Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "#); + "); // squash --from let stderr = test_env.jj_cmd_failure(&repo_path, &["squash", "--from=main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // squash --into let stderr = test_env.jj_cmd_failure(&repo_path, &["squash", "--into=main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); // unsquash let stderr = test_env.jj_cmd_failure(&repo_path, &["unsquash", "-r=main"]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" Warning: `jj unsquash` is deprecated; use `jj diffedit --restore-descendants` or `jj squash` instead Warning: `jj unsquash` will be removed in a future version, and this will be a hard error Error: Commit bcab555fc80e is immutable Hint: Could not modify commit: mzvwutvl bcab555f main | (conflict) merge Hint: Pass `--ignore-immutable` or configure the set of immutable commits via `revset-aliases.immutable_heads()`. - "###); + "); } diff --git a/cli/tests/test_init_command.rs b/cli/tests/test_init_command.rs index b09aaa150b..a78a88a431 100644 --- a/cli/tests/test_init_command.rs +++ b/cli/tests/test_init_command.rs @@ -18,11 +18,11 @@ use crate::common::TestEnvironment; fn test_init_local_disallowed() { let test_env = TestEnvironment::default(); let stdout = test_env.jj_cmd_failure(test_env.env_root(), &["init", "repo"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Error: The native backend is disallowed by default. Hint: Did you mean to call `jj git init`? Set `ui.allow-init-native` to allow initializing a repo with the native backend. - "###); + "); } #[test] @@ -31,9 +31,7 @@ fn test_init_local() { test_env.add_config(r#"ui.allow-init-native = true"#); let (stdout, stderr) = test_env.jj_cmd_ok(test_env.env_root(), &["init", "repo"]); insta::assert_snapshot!(stdout, @""); - insta::assert_snapshot!(stderr, @r###" - Initialized repo in "repo" - "###); + insta::assert_snapshot!(stderr, @r#"Initialized repo in "repo""#); let workspace_root = test_env.env_root().join("repo"); let jj_path = workspace_root.join(".jj"); @@ -54,12 +52,8 @@ fn test_init_local() { test_env.env_root(), &["init", "--ignore-working-copy", "repo2"], ); - insta::assert_snapshot!(stderr, @r###" - Error: --ignore-working-copy is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --ignore-working-copy is not respected"); let stderr = test_env.jj_cmd_cli_error(test_env.env_root(), &["init", "--at-op=@-", "repo3"]); - insta::assert_snapshot!(stderr, @r###" - Error: --at-op is not respected - "###); + insta::assert_snapshot!(stderr, @"Error: --at-op is not respected"); } diff --git a/cli/tests/test_interdiff_command.rs b/cli/tests/test_interdiff_command.rs index 5943753afb..117f5a4362 100644 --- a/cli/tests/test_interdiff_command.rs +++ b/cli/tests/test_interdiff_command.rs @@ -33,11 +33,11 @@ fn test_interdiff_basic() { // implicit --to let stdout = test_env.jj_cmd_success(&repo_path, &["interdiff", "--from", "left"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file2: 1 1: foo 2: bar - "###); + "); // explicit --to test_env.jj_cmd_ok(&repo_path, &["new", "@-"]); @@ -45,11 +45,11 @@ fn test_interdiff_basic() { &repo_path, &["interdiff", "--from", "left", "--to", "right"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file2: 1 1: foo 2: bar - "###); + "); test_env.jj_cmd_ok(&repo_path, &["undo"]); // formats specifiers @@ -57,15 +57,13 @@ fn test_interdiff_basic() { &repo_path, &["interdiff", "--from", "left", "--to", "right", "-s"], ); - insta::assert_snapshot!(stdout, @r###" - M file2 - "###); + insta::assert_snapshot!(stdout, @"M file2"); let stdout = test_env.jj_cmd_success( &repo_path, &["interdiff", "--from", "left", "--to", "right", "--git"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file2 b/file2 index 257cc5642c..3bd1f0e297 100644 --- a/file2 @@ -73,7 +71,7 @@ fn test_interdiff_basic() { @@ -1,1 +1,2 @@ foo +bar - "###); + "); } #[test] @@ -101,10 +99,10 @@ fn test_interdiff_paths() { &repo_path, &["interdiff", "--from", "left", "--to", "right", "file1"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1: 1 1: barbaz - "###); + "); let stdout = test_env.jj_cmd_success( &repo_path, @@ -118,12 +116,12 @@ fn test_interdiff_paths() { "file2", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" Modified regular file file1: 1 1: barbaz Modified regular file file2: 1 1: barbaz - "###); + "); } #[test] @@ -147,7 +145,7 @@ fn test_interdiff_conflicting() { &repo_path, &["interdiff", "--from", "left", "--to", "right", "--git"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" diff --git a/file b/file index 0000000000..24c5735c3e 100644 --- a/file @@ -161,5 +159,5 @@ fn test_interdiff_conflicting() { -bar ->>>>>>> Conflict 1 of 1 ends +def - "###); + "); } diff --git a/cli/tests/test_log_command.rs b/cli/tests/test_log_command.rs index a344126f46..84c907072a 100644 --- a/cli/tests/test_log_command.rs +++ b/cli/tests/test_log_command.rs @@ -22,11 +22,11 @@ fn test_log_with_empty_revision() { let repo_path = test_env.env_root().join("repo"); let stderr = test_env.jj_cmd_cli_error(&repo_path, &["log", "-r="]); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: a value is required for '--revisions ' but none was supplied For more information, try '--help'. - "###); + "); } #[test] @@ -72,14 +72,14 @@ fn test_log_with_or_without_diff() { std::fs::write(repo_path.join("file1"), "foo\nbar\n").unwrap(); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ a new commit ○ add a file ◆ - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ a new commit │ Modified regular file file1: │ 1 1: foo @@ -88,17 +88,17 @@ fn test_log_with_or_without_diff() { │ Added regular file file1: │ 1: foo ◆ - "###); + "); let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "--no-graph"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" a new commit add a file - "###); + "); // `-p` for default diff output, `-s` for summary let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-p", "-s"]); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ a new commit │ M file1 │ Modified regular file file1: @@ -109,7 +109,7 @@ fn test_log_with_or_without_diff() { │ Added regular file file1: │ 1: foo ◆ - "###); + "); // `-s` for summary, `--git` for git diff (which implies `-p`) let stdout = test_env.jj_cmd_success(&repo_path, &["log", "-T", "description", "-s", "--git"]); @@ -147,20 +147,20 @@ fn test_log_with_or_without_diff() { "--config=ui.diff.format=summary", ], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ a new commit │ M file1 ○ add a file │ A file1 ◆ - "###); + "); // `-p` enables default "color-words" diff output, so `--color-words` is noop let stdout = test_env.jj_cmd_success( &repo_path, &["log", "-T", "description", "-p", "--color-words"], ); - insta::assert_snapshot!(stdout, @r###" + insta::assert_snapshot!(stdout, @r" @ a new commit │ Modified regular file file1: │ 1 1: foo @@ -169,7 +169,7 @@ fn test_log_with_or_without_diff() { │ Added regular file file1: │ 1: foo ◆ - "###); + "); // `--git` enables git diff, so `-p` is noop let stdout = test_env.jj_cmd_success( @@ -208,40 +208,40 @@ fn test_log_with_or_without_diff() { "--color-words", ], ); - insta::assert_snapshot!(stderr, @r###" + insta::assert_snapshot!(stderr, @r" error: the argument '--git' cannot be used with '--color-words' Usage: jj log --template