begin adding normal-delete tests
This commit is contained in:
@@ -1,2 +1,59 @@
|
|||||||
structure NormalDelete =
|
structure NormalDelete =
|
||||||
struct open Railroad open Railroad.Test open InputMsg val tests = [] end
|
struct
|
||||||
|
open Railroad
|
||||||
|
open Railroad.Test
|
||||||
|
open InputMsg
|
||||||
|
|
||||||
|
val dhDelete = describe "delete motion 'dh'"
|
||||||
|
[ test "does not delete when cursor is at index 0" (fn _ =>
|
||||||
|
let
|
||||||
|
(* arrange *)
|
||||||
|
val originalString = "hello world\n"
|
||||||
|
val app = TestUtils.init originalString
|
||||||
|
val app = AppWith.idx (app, 0)
|
||||||
|
|
||||||
|
(* act *)
|
||||||
|
val app = TestUtils.updateMany (app, "dh")
|
||||||
|
|
||||||
|
(* assert *)
|
||||||
|
val expectedString = originalString
|
||||||
|
val actualString = LineGap.toString (#buffer app)
|
||||||
|
in
|
||||||
|
Expect.isTrue (expectedString = actualString)
|
||||||
|
end)
|
||||||
|
, test "does not delete when character before cursor is a newline" (fn _ =>
|
||||||
|
let
|
||||||
|
(* arrange *)
|
||||||
|
val originalString = "hello\nworld\n"
|
||||||
|
val app = TestUtils.init originalString
|
||||||
|
val app = AppWith.idx (app, 6)
|
||||||
|
|
||||||
|
(* act *)
|
||||||
|
val app = TestUtils.updateMany (app, "dh")
|
||||||
|
|
||||||
|
(* assert *)
|
||||||
|
val expectedString = originalString
|
||||||
|
val actualString = LineGap.toString (#buffer app)
|
||||||
|
in
|
||||||
|
Expect.isTrue (expectedString = actualString)
|
||||||
|
end)
|
||||||
|
, test "deletes one char to the left when on a non-newline" (fn _ =>
|
||||||
|
let
|
||||||
|
(* arrange *)
|
||||||
|
val originalString = "hello world\n"
|
||||||
|
val app = TestUtils.init originalString
|
||||||
|
val app = AppWith.idx (app, 5)
|
||||||
|
|
||||||
|
(* act *)
|
||||||
|
val app = TestUtils.updateMany (app, "dh")
|
||||||
|
|
||||||
|
(* assert *)
|
||||||
|
val expectedString = "hell world\n"
|
||||||
|
val actualString = LineGap.toString (#buffer app)
|
||||||
|
in
|
||||||
|
Expect.isTrue (expectedString = actualString)
|
||||||
|
end)
|
||||||
|
]
|
||||||
|
|
||||||
|
val tests = [dhDelete]
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user