From a51b820de4c99ab7ee78303cd2db4c115e7d332d Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Mon, 1 Jan 2024 21:56:02 -0800 Subject: [PATCH] (DO NOT MERGE) Replace `.upper()` to use readable case instead of upper case This is for easier testing. --- cli/src/commit_templater.rs | 6 +++--- cli/tests/test_commit_template.rs | 4 ++-- cli/tests/test_templater.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cli/src/commit_templater.rs b/cli/src/commit_templater.rs index 752c0ddf74..99431fe56f 100644 --- a/cli/src/commit_templater.rs +++ b/cli/src/commit_templater.rs @@ -696,11 +696,11 @@ fn to_readable_case(s: &str) -> String { impl ShortestIdPrefix { fn to_upper(&self) -> Self { Self { - prefix: self.prefix.to_ascii_uppercase(), - rest: self.rest.to_ascii_uppercase(), + // TODO: Undo this + prefix: to_readable_case(&self.prefix), + rest: to_readable_case(&self.rest), } } - fn to_readable(&self) -> Self { Self { prefix: to_readable_case(&self.prefix), diff --git a/cli/tests/test_commit_template.rs b/cli/tests/test_commit_template.rs index 6bb6a74be3..8f054fccdd 100644 --- a/cli/tests/test_commit_template.rs +++ b/cli/tests/test_commit_template.rs @@ -512,8 +512,8 @@ fn test_log_customize_short_id() { ], ); insta::assert_snapshot!(stdout, @r###" - @ QPVUNTSM test.user@example.com 2001-02-03 04:05:08.000 +07:00 69542c19 + @ QpVuNtsm test.user@example.com 2001-02-03 04:05:08.000 +07:00 69542c19 │ (empty) first - ◉ ZZZZZZZZ root() 00000000 + ◉ zzzzzzzz root() 00000000 "###); } diff --git a/cli/tests/test_templater.rs b/cli/tests/test_templater.rs index 23916039e8..fed3bd1231 100644 --- a/cli/tests/test_templater.rs +++ b/cli/tests/test_templater.rs @@ -44,7 +44,7 @@ fn test_templater_upper_lower() { insta::assert_snapshot!( render(r#"change_id.shortest(4).upper() ++ change_id.shortest(4).upper().lower()"#), - @"ZZZZzzzz"); + @"zzzzzzzz"); insta::assert_snapshot!( render(r#""Hello".upper() ++ "Hello".lower()"#), @"HELLOhello"); }