amend tests for vi's 'j' motion, after having reimplemented it
This commit is contained in:
@@ -260,9 +260,7 @@ struct
|
|||||||
in
|
in
|
||||||
Expect.isTrue c1
|
Expect.isTrue c1
|
||||||
end)
|
end)
|
||||||
, test
|
, test "when next newline is preceded by char, goes to idx after newline"
|
||||||
"goes to first newline when there are two consecutive newlines\
|
|
||||||
\ahead of the cursor"
|
|
||||||
(fn _ =>
|
(fn _ =>
|
||||||
let
|
let
|
||||||
(* arrange *)
|
(* arrange *)
|
||||||
@@ -270,11 +268,9 @@ struct
|
|||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val {cursorIdx, ...} = TestUtils.update (app, CHAR_EVENT #"j")
|
val {cursorIdx, ...} = TestUtils.update (app, CHAR_EVENT #"j")
|
||||||
|
|
||||||
(* assert *)
|
|
||||||
val isSkipped = cursorIdx = 5
|
|
||||||
in
|
in
|
||||||
Expect.isTrue isSkipped
|
(* assert *)
|
||||||
|
Expect.isTrue (cursorIdx = 6)
|
||||||
end)
|
end)
|
||||||
, test "moves to same column on last line after a count" (fn _ =>
|
, test "moves to same column on last line after a count" (fn _ =>
|
||||||
let
|
let
|
||||||
@@ -344,15 +340,12 @@ struct
|
|||||||
in
|
in
|
||||||
Expect.isTrue isAtEnd
|
Expect.isTrue isAtEnd
|
||||||
end)
|
end)
|
||||||
, test
|
, test "goes to next idx when cursor is on a newline" (fn _ =>
|
||||||
"goes to next char when cursor is on a newline \
|
|
||||||
\and next char is not a newline"
|
|
||||||
(fn _ =>
|
|
||||||
let
|
let
|
||||||
(* arrange *)
|
(* arrange *)
|
||||||
val str = "hello\n\nworld\n"
|
val str = "hello\n\nworld\n"
|
||||||
val app = TestUtils.init str
|
val app = TestUtils.init str
|
||||||
val app = AppWith.idx (app, 5)
|
val app = AppWith.idx (app, 6)
|
||||||
|
|
||||||
(* act *)
|
(* act *)
|
||||||
val {cursorIdx, ...} = TestUtils.update (app, CHAR_EVENT #"j")
|
val {cursorIdx, ...} = TestUtils.update (app, CHAR_EVENT #"j")
|
||||||
|
|||||||
Reference in New Issue
Block a user