about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-09 18:36:16 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-09 18:36:16 -0700
commitf554ce878b3bda9488e71015cc4c56046d0cef17 (patch)
treeafecd18f7b88d71ee0190ce6628e57c7938a2219
parent4476eb894615d07797c8db46025f611bb50cefd4 (diff)
downloadlines.love-f554ce878b3bda9488e71015cc4c56046d0cef17.tar.gz
include a unit test
-rw-r--r--text_tests.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/text_tests.lua b/text_tests.lua
index ab7ac10..4a30156 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -254,6 +254,23 @@ function test_select_text_repeatedly_using_mouse_and_shift()
   check_eq(Cursor1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:pos')
 end
 
+function test_cut_without_selection()
+  io.write('\ntest_cut_without_selection')
+  -- display a few lines
+  App.screen.init{width=25+30, height=60}
+  Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
+  Line_width = App.screen.width
+  Cursor1 = {line=1, pos=2}
+  Screen_top1 = {line=1, pos=1}
+  Screen_bottom1 = {}
+  Selection1 = {}
+  App.draw()
+  -- try to cut without selecting text
+  App.run_after_keychord('C-x')
+  -- no crash
+  check_nil(Selection1.line, 'F - test_cut_without_selection')
+end
+
 function test_pagedown()
   io.write('\ntest_pagedown')
   App.screen.init{width=120, height=45}