done adding tests for 'dge' motion

This commit is contained in:
2025-10-15 08:52:25 +01:00
parent 5206ec555d
commit 066c39c98d
2 changed files with 49 additions and 1 deletions

View File

@@ -1 +1 @@
hello!world!again\ hello again

View File

@@ -2435,6 +2435,54 @@ struct
val actualString = LineGap.toString buffer 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 stringIsExpected = expectedString = actualString
val cursorIsExpected = expectedCursor = cursorIdx val cursorIsExpected = expectedCursor = cursorIdx
in in