From e7a73626e826bad1a39dffdd8e8c47bd8b8d2d57 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 22 Dec 2021 11:54:54 -0800 Subject: [PATCH] toot-toot: a few more tests ..before a change in approach. --- toot-toot.tlv | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/toot-toot.tlv b/toot-toot.tlv index 5c6f1fe..d943487 100644 --- a/toot-toot.tlv +++ b/toot-toot.tlv @@ -271,6 +271,16 @@ > end > return newidx >end + > + >function test_cursor_down() + > check_eq(cursor_down('abc\ndef', 1), 5, 'cursor_down: non-bottom line first char') + > check_eq(cursor_down('abc\ndef', 2), 6, 'cursor_down: non-bottom line mid char') + > check_eq(cursor_down('abc\ndef', 3), 7, 'cursor_down: non-bottom line final char') + > check_eq(cursor_down('abc\ndef', 4), 8, 'cursor_down: non-bottom line end') + > check_eq(cursor_down('abc\ndef', 5), 5, 'cursor_down: bottom line first char') + > check_eq(cursor_down('abc\ndef', 6), 6, 'cursor_down: bottom line mid char') + > check_eq(cursor_down('abc\ndef', 7), 7, 'cursor_down: bottom line final char') + >end - __teliva_timestamp: original skip_past_newline: >function skip_past_newline(s, idx) @@ -376,7 +386,12 @@ > check_eq(cursor_up('abc\ndef', 2), 2, 'cursor_up: top line mid char') > check_eq(cursor_up('abc\ndef', 3), 3, 'cursor_up: top line final char') > check_eq(cursor_up('abc\ndef', 4), 4, 'cursor_up: top line end') - > check_eq(cursor_up('abc\ndef', 5), 1, 'cursor_up: second line first char') + > check_eq(cursor_up('abc\ndef', 5), 1, 'cursor_up: non-top line first char') + > check_eq(cursor_up('abc\ndef', 6), 2, 'cursor_up: non-top line mid char') + > check_eq(cursor_up('abc\ndef', 7), 3, 'cursor_up: non-top line final char') + > check_eq(cursor_up('abc\ndef\n', 8), 4, 'cursor_up: non-top line end') + > check_eq(cursor_up('ab\ndef\n', 7), 3, 'cursor_up: to shorter line') + > -- idx that's too high for s not working; let's see if that matters >end - __teliva_timestamp: original render: