vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 14c9f3ff5496deb6ac059a77e3c47d0a306893d4 parent 1ada39321715709839841d062659793d2ac8f8e2 Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 16 May 2016 22:50:13 +0200 test/lua: fix test for invalid cursor position Diffstat:
| M | lua/basic_cursor.lua | | | 19 | +++++++++++-------- |
| M | lua/basic_cursor.ref | | | 1 | + |
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/lua/basic_cursor.lua b/lua/basic_cursor.lua @@ -18,16 +18,19 @@ win.cursor:to(0, 0) results[10] = win.cursor.line == 1 results[11] = win.cursor.col == 1 results[12] = win.cursor.pos == 0 --- Invalid location, negative (TODO these two seem flaky) -win.cursor:to(-20, -20) -results[13] = win.cursor.line == 1 or true -results[14] = win.cursor.col == 1 -results[15] = win.cursor.pos == 0 or true +-- Invalid location, negative +local ok, msg = pcall(function() + win.cursor:to(-20, -20) +end) +results[13] = not ok +results[14] = win.cursor.line == 1 +results[15] = win.cursor.col == 1 +results[16] = win.cursor.pos == 0 -- Invalid location, after end of text, cursor ends up on last char win.cursor:to(1000, 1000) -results[16] = win.cursor.line == 9 or true -results[17] = win.cursor.col == 1 -results[18] = win.cursor.pos == 63 or true +results[17] = win.cursor.line == 9 or true +results[18] = win.cursor.col == 1 +results[19] = win.cursor.pos == 63 or true delete(win, '%') for i, res in pairs(results) do diff --git a/lua/basic_cursor.ref b/lua/basic_cursor.ref @@ -16,3 +16,4 @@ true true true true +true