done adding tests for when cursor is on a space, for 'daw' motion

This commit is contained in:
2025-12-27 02:41:13 +00:00
parent acabbac70a
commit 9e809e146a
2 changed files with 47 additions and 0 deletions

View File

@@ -4517,6 +4517,52 @@ struct
in in
Expect.isTrue (stringsAreExpected andalso cursorsAreExpected) Expect.isTrue (stringsAreExpected andalso cursorsAreExpected)
end) end)
, test
"deletes trailing spaces when cursor is on word \
\that has multiple trailing spaces after it"
(fn _ =>
let
(* arrange *)
val originalString = "hello again world\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 7)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "daw")
(* assert *)
val expectedString = "hello world\n"
val actualString = LineGap.toString buffer
val expectedCursorIdx = 6
in
Expect.isTrue
(actualString = expectedString
andalso cursorIdx = expectedCursorIdx)
end)
, test
"deletes last world on line when cursor is on space \
\which immediately precedes last word"
(fn _ =>
let
(* arrange *)
val originalString = "hello again world\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 13)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "daw")
(* assert *)
val expectedString = "hello again\n"
val actualString = LineGap.toString buffer
val expectedCursorIdx = 10
in
Expect.isTrue
(actualString = expectedString
andalso cursorIdx = expectedCursorIdx)
end)
] ]
val tests = val tests =

View File

@@ -2,6 +2,7 @@
- Add tests for: - Add tests for:
- Test delete-around-word/WORD - Test delete-around-word/WORD
- Delete-around-word has tests for when cursor is on space (needs tests for alpha and punctuation too)
- Reimple `%` motion and `d%` motion. - Reimple `%` motion and `d%` motion.
- They should both search for the next character in any pair, the same way in Vim - They should both search for the next character in any pair, the same way in Vim
- Add tests for reimplemented movements and motions - Add tests for reimplemented movements and motions