From 63161cee218cfd8a7e14049ddb7a4bf8d75fa7d4 Mon Sep 17 00:00:00 2001 From: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:27:40 +0000 Subject: [PATCH] fix: incorrect test --- helix-core/src/case_conversion.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/helix-core/src/case_conversion.rs b/helix-core/src/case_conversion.rs index 619293b4b..2cd13f9e7 100644 --- a/helix-core/src/case_conversion.rs +++ b/helix-core/src/case_conversion.rs @@ -99,15 +99,12 @@ pub fn to_case_with_separator( buf: &mut Tendril, separator: char, ) { - let mut prev_is_lowercase = false; // Tracks if the previous character was lowercase - let mut prev_is_alphanumeric = false; // Tracks if the previous character was alphanumeric + let mut prev_is_lowercase = false; + let mut prev_is_alphanumeric = false; for c in text { if c.is_alphanumeric() { - if prev_is_lowercase && c.is_uppercase() { - buf.push(separator); - } - if !prev_is_alphanumeric && !buf.is_empty() { + if prev_is_lowercase && c.is_uppercase() || !prev_is_alphanumeric && !buf.is_empty() { buf.push(separator); } @@ -311,6 +308,6 @@ mod tests { snake_test("HELLO-world", "hello_world"); snake_test("hello WORLD ", "hello_world"); snake_test("helloWorld", "hello_world"); - // snake_test("HELLOworld123", "hello_world123"); + snake_test("helloWORLD123", "hello_world123"); } }