add tests for 'da<symbol>' motion, finishing all delete-tests

This commit is contained in:
2026-01-03 08:39:41 +00:00
parent 210d535b9f
commit d2f32c1512
2 changed files with 78 additions and 6 deletions

View File

@@ -5151,6 +5151,82 @@ struct
end)
]
val daParenDelete = describe "delete motion 'da('"
[ test "does not delete when there is no ( after the cursor" (fn _ =>
let
(* arrange *)
val originalString = " ( ) hello\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 7)
(* act *)
val {buffer, ...} = TestUtils.updateMany (app, "da(")
(* assert *)
val expectedString = originalString
val actualString = LineGap.toString buffer
in
Expect.isTrue (expectedString = actualString)
end)
, test
"deletes pair after cursor when there is a pair \
\before the cursor and after the cursor"
(fn _ =>
let
(* arrange *)
val originalString = " ( abc ) xyz ( def )\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 9)
(* act *)
val {buffer, ...} = TestUtils.updateMany (app, "da(")
(* assert *)
val expectedString = " ( abc ) xyz \n"
val actualString = LineGap.toString buffer
in
Expect.isTrue (expectedString = actualString)
end)
, test
"deletes outer parens when cursor is in \
\outer paren, and there is an inner paren after cursor"
(fn _ =>
let
(* arrange *)
val originalString = "( ( hello ) )\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 1)
(* act *)
val {buffer, ...} = TestUtils.updateMany (app, "da(")
(* assert *)
val expectedString = "\n"
val actualString = LineGap.toString buffer
in
Expect.isTrue (expectedString = actualString)
end)
, test
"deletes inner parren when cursor is in inner paren-pair, \
\and there is an outer paren above this inner paren"
(fn _ =>
let
(* arrange *)
val originalString = "( ( hello ) )\n"
val app = TestUtils.init originalString
val app = AppWith.idx (app, 5)
(* act *)
val {buffer, ...} = TestUtils.updateMany (app, "da(")
(* assert *)
val expectedString = "( )\n"
val actualString = LineGap.toString buffer
in
Expect.isTrue (expectedString = actualString)
end)
]
val tests =
[ dhDelete
, dlDelete
@@ -5182,5 +5258,6 @@ struct
, daWDelete
, pairDelete
, diParenDelete
, daParenDelete
]
end

View File

@@ -1,8 +1,3 @@
# To-do list
- Add tests for:
- `da<symbol>`
Afterwards, add tests for yanking.
Add yank commands like yh/yj/yk/yl as well and test them too.
- Add yank commands like yh/yj/yk/yl as well and then add tests for yanking.