From 5206ec555d5939c0a827ad1231a41d51f195619c Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Tue, 14 Oct 2025 16:26:12 +0100 Subject: [PATCH] add a test for 'dge' motion --- temp.txt | 4 +--- test/normal-delete.sml | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/temp.txt b/temp.txt index 0056b4a..caa79a8 100644 --- a/temp.txt +++ b/temp.txt @@ -1,3 +1 @@ -hello -world -again +hello!world!again\ diff --git a/test/normal-delete.sml b/test/normal-delete.sml index 83a04bd..ce74399 100644 --- a/test/normal-delete.sml +++ b/test/normal-delete.sml @@ -2415,6 +2415,31 @@ struct in Expect.isTrue (stringIsExpected andalso cursorIsExpected) end) + , test + "deletes only two chars when cursor is \ + \on an a punctuation char which is immediately preceded \ + \by an alpha char" + (fn _ => + let + (* arrange *) + val originalString = "hello!world!again\n" + val app = TestUtils.init originalString + val app = AppWith.idx (app, 5) + + (* act *) + val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dge") + + (* assert *) + val expectedString = "hellworld!again\n" + val expectedCursor = 4 + + val actualString = LineGap.toString buffer + + val stringIsExpected = expectedString = actualString + val cursorIsExpected = expectedCursor = cursorIdx + in + Expect.isTrue (stringIsExpected andalso cursorIsExpected) + end) ] val tests =