From 066c39c98d72f5419d7278517acc197c190e94b4 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Wed, 15 Oct 2025 08:52:25 +0100 Subject: [PATCH] done adding tests for 'dge' motion --- temp.txt | 2 +- test/normal-delete.sml | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/temp.txt b/temp.txt index caa79a8..5b42468 100644 --- a/temp.txt +++ b/temp.txt @@ -1 +1 @@ -hello!world!again\ +hello again diff --git a/test/normal-delete.sml b/test/normal-delete.sml index ce74399..2b5437d 100644 --- a/test/normal-delete.sml +++ b/test/normal-delete.sml @@ -2435,6 +2435,54 @@ struct val actualString = LineGap.toString buffer + val stringIsExpected = expectedString = actualString + val cursorIsExpected = expectedCursor = cursorIdx + in + Expect.isTrue (stringIsExpected andalso cursorIsExpected) + end) + , test + "deletes only one punctuation char when on an alpha char \ + \which is preceded by punctuation" + (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, "dge") + + (* assert *) + val expectedString = "!#%&lo\n" + val expectedCursor = 4 + + val actualString = LineGap.toString buffer + + val stringIsExpected = expectedString = actualString + val cursorIsExpected = expectedCursor = cursorIdx + in + Expect.isTrue (stringIsExpected andalso cursorIsExpected) + end) + , test + "deletes spaces until reaching non-space char, \ + \when cursor is on space and is preceded by more spaces" + (fn _ => + let + (* arrange *) + val originalString = "hello again\n" + val app = TestUtils.init originalString + val app = AppWith.idx (app, 13) + + (* act *) + val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dge") + + (* assert *) + val expectedString = "hell again\n" + val expectedCursor = 4 + + val actualString = LineGap.toString buffer + val stringIsExpected = expectedString = actualString val cursorIsExpected = expectedCursor = cursorIdx in