From 4aeb4f6e2a090e80d1eb95635973172aa8772168 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Fri, 6 Jan 2023 22:11:37 -0800 Subject: [PATCH] tests: drop no-longer-needed filtering of change ID Our change IDs are now predictable in tests. --- tests/test_git_push.rs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/tests/test_git_push.rs b/tests/test_git_push.rs index 9aa875a7b..cff04bfe6 100644 --- a/tests/test_git_push.rs +++ b/tests/test_git_push.rs @@ -209,17 +209,11 @@ fn test_git_push_changes() { test_env.jj_cmd_success(&workspace_root, &["new", "-m", "bar"]); std::fs::write(workspace_root.join("file"), "modified").unwrap(); - fn replace_changeid(s: &str) -> String { - regex::Regex::new(r"[0-9a-f]{32}") - .unwrap() - .replace_all(s, "") - .to_string() - } let stdout = test_env.jj_cmd_success(&workspace_root, &["git", "push", "--change", "@"]); - insta::assert_snapshot!(replace_changeid(&stdout), @r###" - Creating branch push- for revision @ + insta::assert_snapshot!(stdout, @r###" + Creating branch push-1b76972398e6449e8e0701307e57d55a for revision @ Branch changes to push to origin: - Add branch push- to 28d7620ea63a + Add branch push-1b76972398e6449e8e0701307e57d55a to 28d7620ea63a "###); // test pushing two changes at once std::fs::write(workspace_root.join("file"), "modified2").unwrap(); @@ -227,11 +221,11 @@ fn test_git_push_changes() { &workspace_root, &["git", "push", "--change", "@", "--change", "@-"], ); - insta::assert_snapshot!(replace_changeid(&stdout), @r###" - Creating branch push- for revision @- + insta::assert_snapshot!(stdout, @r###" + Creating branch push-19b790168e7347a7ba98deae21e807c0 for revision @- Branch changes to push to origin: - Force branch push- from 28d7620ea63a to 48d8c7948133 - Add branch push- to fa16a14170fb + Force branch push-1b76972398e6449e8e0701307e57d55a from 28d7620ea63a to 48d8c7948133 + Add branch push-19b790168e7347a7ba98deae21e807c0 to fa16a14170fb "###); // specifying the same change twice doesn't break things std::fs::write(workspace_root.join("file"), "modified3").unwrap(); @@ -239,9 +233,9 @@ fn test_git_push_changes() { &workspace_root, &["git", "push", "--change", "@", "--change", "@"], ); - insta::assert_snapshot!(replace_changeid(&stdout), @r###" + insta::assert_snapshot!(stdout, @r###" Branch changes to push to origin: - Force branch push- from 48d8c7948133 to b5f030322b1d + Force branch push-1b76972398e6449e8e0701307e57d55a from 48d8c7948133 to b5f030322b1d "###); }