begin adding tests for 'dk' motion

This commit is contained in:
2025-09-25 09:03:40 +01:00
parent 0255b127a7
commit 2c3eb6a8a1

View File

@@ -612,5 +612,50 @@ struct
end) end)
] ]
val tests = [dhDelete, dlDelete, djDelete, ddDelete] val dkDelete = describe "delete motion 'dk'"
[ test "does not delete when cursor is on first line" (fn _ =>
let
(* arrange *)
val originalString = "hello\nworld\n"
val originalIdx = 0
val app = TestUtils.init originalString
val app = AppWith.idx (app, originalIdx)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dk")
(* assert *)
val expectedString = originalString
val actualString = LineGap.toString buffer
val expectedIdx = 0
in
Expect.isTrue
(expectedString = actualString andalso expectedIdx = cursorIdx)
end)
, test "deletes first two lines when cursor is on second line" (fn _ =>
let
(* arrange *)
val originalString = "hello\nworld\n"
val originalIdx = 6
val app = TestUtils.init originalString
val app = AppWith.idx (app, originalIdx)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dk")
(* assert *)
val expectedString = "\n"
val actualString = LineGap.toString buffer
val expectedIdx = 0
in
Expect.isTrue
(expectedString = actualString andalso expectedIdx = cursorIdx)
end)
]
val tests = [dhDelete, dlDelete, djDelete, ddDelete, dkDelete]
end end