From b596b4153ffbc4b911c6519eacf36256f31b0745 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Fri, 20 Oct 2023 10:34:09 -0600 Subject: [PATCH] Fix test --- crates/editor/src/display_map.rs | 2 +- crates/editor/src/editor_tests.rs | 21 ++++++++++----------- crates/editor/src/movement.rs | 1 - 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 6e179950f3..184990ea78 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -1007,7 +1007,7 @@ pub mod tests { use settings::SettingsStore; use smol::stream::StreamExt; use std::{env, sync::Arc}; - use theme::{SyntaxTheme, Theme}; + use theme::SyntaxTheme; use util::test::{marked_text_ranges, sample_text}; use Bias::*; diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index 6cc78385a3..664db53e1a 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -847,7 +847,6 @@ fn test_move_cursor(cx: &mut TestAppContext) { #[gpui::test] fn test_move_cursor_multibyte(cx: &mut TestAppContext) { - todo!(); init_test(cx, |_| {}); let view = cx @@ -889,6 +888,11 @@ fn test_move_cursor_multibyte(cx: &mut TestAppContext) { ); view.move_down(&MoveDown, cx); + assert_eq!( + view.selections.display_ranges(cx), + &[empty_range(1, "ab⋯e".len())] + ); + view.move_left(&MoveLeft, cx); assert_eq!( view.selections.display_ranges(cx), &[empty_range(1, "ab⋯".len())] @@ -931,16 +935,6 @@ fn test_move_cursor_multibyte(cx: &mut TestAppContext) { &[empty_range(1, "ab⋯e".len())] ); view.move_up(&MoveUp, cx); - assert_eq!( - view.selections.display_ranges(cx), - &[empty_range(0, "ⓐⓑ⋯ⓔ".len())] - ); - view.move_left(&MoveLeft, cx); - assert_eq!( - view.selections.display_ranges(cx), - &[empty_range(0, "ⓐⓑ⋯".len())] - ); - view.move_left(&MoveLeft, cx); assert_eq!( view.selections.display_ranges(cx), &[empty_range(0, "ⓐⓑ".len())] @@ -950,6 +944,11 @@ fn test_move_cursor_multibyte(cx: &mut TestAppContext) { view.selections.display_ranges(cx), &[empty_range(0, "ⓐ".len())] ); + view.move_left(&MoveLeft, cx); + assert_eq!( + view.selections.display_ranges(cx), + &[empty_range(0, "".len())] + ); }); } diff --git a/crates/editor/src/movement.rs b/crates/editor/src/movement.rs index 8f5d0d802c..580faf1050 100644 --- a/crates/editor/src/movement.rs +++ b/crates/editor/src/movement.rs @@ -429,7 +429,6 @@ mod tests { test::{editor_test_context::EditorTestContext, marked_display_snapshot}, Buffer, DisplayMap, ExcerptRange, InlayId, MultiBuffer, }; - use language::language_settings::AllLanguageSettings; use project::Project; use settings::SettingsStore; use util::post_inc;