From ef9da12a0b1be327e6fc90f971bd1929b4cba6be Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sat, 31 Jan 2026 21:18:21 +0000 Subject: [PATCH] begin adding tests for 'yj' motion, based on tests for 'dj' motion --- test/normal-yank-tests.sml | 55 +++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/test/normal-yank-tests.sml b/test/normal-yank-tests.sml index 78d4661..9fba8a3 100644 --- a/test/normal-yank-tests.sml +++ b/test/normal-yank-tests.sml @@ -377,5 +377,58 @@ struct end) ] - val tests = [yhYank, ylYank, ykYank] + val yjYank = describe "yank motion 'yj'" + [ test "does not yank any text when cursor is on last line" (fn _ => + let + (* arrange *) + val originalString = "hello\nworld\n" + val originalIdx = String.size originalString - 3 + + val app = TestUtils.init originalString + val app = AppWith.idx (app, originalIdx) + + (* act *) + val app = TestUtils.updateMany (app, "yj") + in + (* assert *) + TestUtils.expectNoYank app + end) + , test "does not yank when there is only one line" (fn _ => + let + (* arrange *) + val originalString = "hello\n" + val originalIdx = 0 + + val app = TestUtils.init originalString + val app = AppWith.idx (app, originalIdx) + + (* act *) + val app = TestUtils.updateMany (app, "yj") + in + (* assert *) + TestUtils.expectNoYank app + end) + , test + "yanks first two lines when cursor is on first line \ + \and there are at least two lines" + (fn _ => + let + (* arrange *) + val originalString = "hello\nworld\n" + val originalIdx = 0 + + val app = TestUtils.init originalString + val app = AppWith.idx (app, originalIdx) + + (* act *) + val app = TestUtils.updateMany (app, "yj") + + (* assert *) + val expectedString = originalString + in + TestUtils.expectYank (app, expectedString) + end) + ] + + val tests = [yhYank, ylYank, ykYank, yjYank] end