toot-toot: a few more tests

..before a change in approach.
This commit is contained in:
Kartik K. Agaram 2021-12-22 11:54:54 -08:00
parent 0a1d5d61cb
commit e7a73626e8
1 changed files with 16 additions and 1 deletions

View File

@ -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: