From 105642b7dec601372b08f9045ec966d1e8ef8d4b 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 79db7a6701c..9df63adec88 100644 --- a/cli/src/commit_templater.rs +++ b/cli/src/commit_templater.rs @@ -695,11 +695,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 c1d0928694b..ca77aa2caac 100644 --- a/cli/tests/test_commit_template.rs +++ b/cli/tests/test_commit_template.rs @@ -508,8 +508,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 23916039e8e..fed3bd12313 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"); }