From cb5013bc25d8b1c0dbdc4800ddefd97530a5f919 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sun, 12 Oct 2025 08:49:50 +0100 Subject: [PATCH] done adding tests for 'db' delete motion --- test/normal-delete.sml | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/test/normal-delete.sml b/test/normal-delete.sml index 819cf24..8860d88 100644 --- a/test/normal-delete.sml +++ b/test/normal-delete.sml @@ -1997,6 +1997,50 @@ struct val actualString = LineGap.toString buffer + val stringIsExpected = expectedString = actualString + val cursorIsExpected = expectedCursor = cursorIdx + in + Expect.isTrue (stringIsExpected andalso cursorIsExpected) + end) + , test "deletes spaces and word before spaces, when cursor is on space" + (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, "db") + + (* assert *) + val expectedString = " again\n" + val expectedCursor = 0 + + val actualString = LineGap.toString buffer + + val stringIsExpected = expectedString = actualString + val cursorIsExpected = expectedCursor = cursorIdx + in + Expect.isTrue (stringIsExpected andalso cursorIsExpected) + end) + , test "does not delete when cursor is on first character of first line" + (fn _ => + let + (* arrange *) + val originalString = "hello world\n" + val app = TestUtils.init originalString + val app = AppWith.idx (app, 0) + + (* act *) + val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "db") + + (* assert *) + val expectedString = originalString + val expectedCursor = 0 + + val actualString = LineGap.toString buffer + val stringIsExpected = expectedString = actualString val cursorIsExpected = expectedCursor = cursorIdx in