From 594367d6d8b76aa7fe7f536cc1b604f89940e081 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Thu, 25 Sep 2025 10:02:16 +0100 Subject: [PATCH] add another failing unit test for 'dk' motion --- temp.txt | 1 + test/normal-delete.sml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/temp.txt b/temp.txt index 7bd861d..204e3fd 100644 --- a/temp.txt +++ b/temp.txt @@ -1,4 +1,5 @@ hello world + trello brillo diff --git a/test/normal-delete.sml b/test/normal-delete.sml index b4f3018..9dcd849 100644 --- a/test/normal-delete.sml +++ b/test/normal-delete.sml @@ -730,6 +730,38 @@ struct Expect.isTrue (expectedString = actualString andalso expectedIdx = cursorIdx) end) + , test + "deletes just newline and line above when cursor is on third line" + (fn _ => + let + (* arrange *) + val originalString = "hello\n\nagain\n" + val originalString = + "hello\n\ + \world\n\ + \\n\ + \trello\n\ + \brillo\n" + val originalIdx = 12 + + val app = TestUtils.init originalString + val app = AppWith.idx (app, originalIdx) + + (* act *) + val {buffer, cursorIdx, ...} = TestUtils.updateMany (app, "dk") + + (* assert *) + val expectedString = + "hello\n\ + \trello\n\ + \brillo\n" + val actualString = LineGap.toString buffer + + val expectedIdx = 6 + in + Expect.isTrue + (expectedString = actualString andalso expectedIdx = cursorIdx) + end) ] val tests = [dhDelete, dlDelete, djDelete, ddDelete, dkDelete]