done adding tests for 'db' delete motion

This commit is contained in:
2025-10-12 08:49:50 +01:00
parent 88e1ae00a9
commit cb5013bc25

View File

@@ -1997,6 +1997,50 @@ struct
val actualString = LineGap.toString buffer
val stringIsExpected = expectedString = actualString
val cursorIsExpected = expectedCursor = cursorIdx
in
Expect.isTrue (stringIsExpected andalso cursorIsExpected)
end)
, test "deletes spaces and word before spaces, when cursor is on space"
(fn _ =>
let
(* arrange *)
val originalString = "hello again\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 13)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "db")
(* assert *)
val expectedString = " again\n"
val expectedCursor = 0
val actualString = LineGap.toString buffer
val stringIsExpected = expectedString = actualString
val cursorIsExpected = expectedCursor = cursorIdx
in
Expect.isTrue (stringIsExpected andalso cursorIsExpected)
end)
, test "does not delete when cursor is on first character of first line"
(fn _ =>
let
(* arrange *)
val originalString = "hello world\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 0)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "db")
(* assert *)
val expectedString = originalString
val expectedCursor = 0
val actualString = LineGap.toString buffer
val stringIsExpected = expectedString = actualString
val cursorIsExpected = expectedCursor = cursorIdx
in