From 99bb3b257ebd10fc2b59000be6aaa93455d08fd1 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sun, 28 Dec 2025 01:37:29 +0000 Subject: [PATCH] done with delete-around-word ('daw') tests. Next: delete-around-WORD ('daW') tests. --- test/normal-delete.sml | 40 ++++++++++++++++++++++++++++++++++++++++ todo.md | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/test/normal-delete.sml b/test/normal-delete.sml index ab6f382..0c6bfca 100644 --- a/test/normal-delete.sml +++ b/test/normal-delete.sml @@ -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 = diff --git a/todo.md b/todo.md index 4fbbdad..c931694 100644 --- a/todo.md +++ b/todo.md @@ -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