done adding tests for d^ motion

This commit is contained in:
2025-10-16 13:19:01 +01:00
parent 91b7d54cc4
commit 2667e58a26
2 changed files with 45 additions and 1 deletions

View File

@@ -3184,6 +3184,51 @@ struct
(actualString = expectedString
andalso cursorIdx = expectedCursorIdx)
end)
, test
"deletes from start of line until first non-space char \
\when cursor is on first character of line \
\and line starts with spaces"
(fn _ =>
let
(* arrange *)
val originalString = " hello\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 0)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "d^")
(* assert *)
val actualString = LineGap.toString buffer
val expectedString = "hello\n"
val expectedCursorIdx = 0
in
Expect.isTrue
(actualString = expectedString
andalso cursorIdx = expectedCursorIdx)
end)
, test
"deletes from cursor position to first non-space char \
\when cursor is on last non-space char at end of line"
(fn _ =>
let
(* arrange *)
val originalString = " hello\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 7)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "d^")
(* assert *)
val actualString = LineGap.toString buffer
val expectedString = " o\n"
val expectedCursorIdx = 3
in
Expect.isTrue
(actualString = expectedString
andalso cursorIdx = expectedCursorIdx)
end)
]
val tests =

View File

@@ -1,7 +1,6 @@
# To-do list
- Add tests for:
- `d^`
- `dd`
- `dn`
- `dN`