From 7223bf93baadc49db9593ce13d2c7dbb623acaa6 Mon Sep 17 00:00:00 2001 From: Remco Smits Date: Mon, 30 Dec 2024 20:16:30 +0100 Subject: [PATCH] Update toggle breakpoint test so cover more cases Co-Authored-By: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com> --- crates/editor/src/editor_tests.rs | 33 ++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index ef6e61c5ca..40d04580a2 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -14806,6 +14806,8 @@ async fn test_breakpoint_toggling(cx: &mut TestAppContext) { window .update(cx, |editor, cx| { editor.toggle_breakpoint(&actions::ToggleBreakpoint, cx); + editor.move_to_end(&MoveToEnd, cx); + editor.toggle_breakpoint(&actions::ToggleBreakpoint, cx); }) .unwrap(); @@ -14827,11 +14829,40 @@ async fn test_breakpoint_toggling(cx: &mut TestAppContext) { assert_breakpoint( &breakpoints, &project_path, - vec![(0, BreakpointKind::Standard)], + vec![(0, BreakpointKind::Standard), (3, BreakpointKind::Standard)], ); window .update(cx, |editor, cx| { + editor.move_to_beginning(&MoveToBeginning, cx); + editor.toggle_breakpoint(&actions::ToggleBreakpoint, cx); + }) + .unwrap(); + + let breakpoints = window + .update(cx, |editor, cx| { + editor + .project + .as_ref() + .unwrap() + .read(cx) + .dap_store() + .read(cx) + .breakpoints() + .clone() + }) + .unwrap(); + + assert_eq!(1, breakpoints.len()); + assert_breakpoint( + &breakpoints, + &project_path, + vec![(3, BreakpointKind::Standard)], + ); + + window + .update(cx, |editor, cx| { + editor.move_to_end(&MoveToEnd, cx); editor.toggle_breakpoint(&actions::ToggleBreakpoint, cx); }) .unwrap();