add a test for 'b' motion, checking that we move to start of prev word when on first character of next word

This commit is contained in:
2025-07-21 00:28:25 +01:00
parent af900057b0
commit 51c9090adf

View File

@@ -1118,6 +1118,19 @@ struct
(* assert *) (* assert *)
Expect.isTrue (cursorIdx = 0) Expect.isTrue (cursorIdx = 0)
end) end)
, test "moves cursor previous word when on first character of next word"
(fn _ =>
let
val buffer = LineGap.fromString "hello world\n"
val app = AppType.init (buffer, 0, 0)
val app = AppWith.idx (app, 6)
val chr1 = getChr app
val app2 = AppUpdate.update (app, CHAR_EVENT #"b")
val chr2 = getChr app2
in
Expect.isTrue (chr1 = #"w" andalso chr2 = #"h")
end)
, test "moves cursor to 0 when cursor > 0 and cursor is on first word" , test "moves cursor to 0 when cursor > 0 and cursor is on first word"
(fn _ => (fn _ =>
let let