done with delete-around-word ('daw') tests. Next: delete-around-WORD ('daW') tests.

This commit is contained in:
2025-12-28 01:37:29 +00:00
parent 6efce2dd67
commit 99bb3b257e
2 changed files with 41 additions and 1 deletions

View File

@@ -4581,6 +4581,46 @@ struct
(actualString = expectedString
andalso cursorIdx = expectedCursorIdx)
end)
, test
"deletes alpha word when cursor is on alpha char \
\and alpha word is surrounded by punctuation chars"
(fn _ =>
let
(* arrange *)
val app = TestUtils.init "#hello#\n"
val app = AppWith.idx (app, 3)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "daw")
(* assert *)
val expectedIdx = 1
val expectedString = "##\n"
val actualString = LineGap.toString buffer
in
Expect.isTrue
(expectedString = actualString andalso expectedIdx = cursorIdx)
end)
, test
"deletes punctuation word when cursor is on punctuation char \
\and punctuation word is surrounded by alpha chars"
(fn _ =>
let
(* arrange *)
val app = TestUtils.init "h#%&(e\n"
val app = AppWith.idx (app, 3)
(* act *)
val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "daw")
(* assert *)
val expectedIdx = 1
val expectedString = "he\n"
val actualString = LineGap.toString buffer
in
Expect.isTrue
(expectedString = actualString andalso expectedIdx = cursorIdx)
end)
]
val tests =

View File

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