From d92d3b3a26be243ad2a7256a6f4b5e4912feb15a Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Tue, 19 Nov 2024 03:53:05 +0000 Subject: [PATCH] add a couple of tests --- test/test.sml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/test.sml b/test/test.sml index 9e8aee7..a0d984e 100644 --- a/test/test.sml +++ b/test/test.sml @@ -5,7 +5,22 @@ open InputMsg val emptyVec = Vector.fromList [] val cursorTests = describe "cursor operations" - [ test "'w' moves cursor to start of next word in contiguous string" (fn _ => + [ test "'l' moves cursor leftward by one when cursorIdx < length" (fn _ => + let + (* arrange *) + val buffer = LineGap.fromString "hello world" + val app = AppType.init (buffer, 0, 0) + + (* act *) + val ({cursorIdx, ...}, _) = AppUpdate.update (app, CHAR_EVENT #"l") + + (* assert *) + in + Expect.isTrue (cursorIdx = 1) + end + ) + + , test "'w' moves cursor to start of next word in contiguous string" (fn _ => let (* arrange *) val buffer = LineGap.fromString "hello world"