flesh out some tests for word movements
[?]
Jul 12, 2022, 1:44 AM
NUZFHX6IUV2KXZOIJQTD5VIU7ELDQCFPDXYBUNQGWLKH3OMYND5QCDependencies
- [2]
AJP4OSTJnew test - [3]
Y2ZIPXEMnew test - [*]
LXTTOB33extract a couple of files - [*]
KOTI3MFGbugfix in previous commit
Change contents
- edit in text_tests.lua at line 63[2.320][6.287]
endfunction test_move_left()io.write('\ntest_move_left')App.screen.init{width=120, height=60}Lines = load_array{'a'}Cursor1 = {line=1, pos=2}Margin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('left')check_eq(Cursor1.pos, 1, 'F - test_move_left')endfunction test_move_right()io.write('\ntest_move_right')App.screen.init{width=120, height=60}Lines = load_array{'a'}Cursor1 = {line=1, pos=1}Margin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('right')check_eq(Cursor1.pos, 2, 'F - test_move_right') - edit in text_tests.lua at line 87
function test_move_left_to_previous_line()io.write('\ntest_move_left_to_previous_line')App.screen.init{width=120, height=60}Lines = load_array{'abc', 'def'}Cursor1 = {line=2, pos=1}Margin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('left')check_eq(Cursor1.line, 1, 'F - test_move_left_to_previous_line/line')check_eq(Cursor1.pos, 4, 'F - test_move_left_to_previous_line/pos') -- past end of lineendfunction test_move_right_to_next_line()io.write('\ntest_move_right_to_next_line')App.screen.init{width=120, height=60}Lines = load_array{'abc', 'def'}Cursor1 = {line=1, pos=4} -- past end of lineMargin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('right')check_eq(Cursor1.line, 2, 'F - test_move_right_to_next_line/line')check_eq(Cursor1.pos, 1, 'F - test_move_right_to_next_line/pos')endfunction test_move_to_start_of_word()io.write('\ntest_move_to_start_of_word')App.screen.init{width=120, height=60}Lines = load_array{'abc'}Cursor1 = {line=1, pos=3}Margin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-left')check_eq(Cursor1.pos, 1, 'F - test_move_to_start_of_word')endfunction test_move_to_start_of_previous_word()io.write('\ntest_move_to_start_of_previous_word')App.screen.init{width=120, height=60}Lines = load_array{'abc def'}Cursor1 = {line=1, pos=4} -- at the space between wordsMargin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-left')check_eq(Cursor1.pos, 1, 'F - test_move_to_start_of_previous_word')endfunction test_skip_to_previous_word()io.write('\ntest_skip_to_previous_word')App.screen.init{width=120, height=60}Lines = load_array{'abc def'}Cursor1 = {line=1, pos=5} -- at the start of second wordMargin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-left')check_eq(Cursor1.pos, 1, 'F - test_skip_to_previous_word')endfunction test_move_to_start_of_word_on_previous_line()io.write('\ntest_move_to_start_of_word_on_previous_line')App.screen.init{width=120, height=60}Lines = load_array{'abc def', 'ghi'}Cursor1 = {line=2, pos=1}Margin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-left')check_eq(Cursor1.line, 1, 'F - test_move_to_start_of_word_on_previous_line/line')check_eq(Cursor1.pos, 5, 'F - test_move_to_start_of_word_on_previous_line/pos')endfunction test_move_past_end_of_word()io.write('\ntest_move_past_end_of_word')App.screen.init{width=120, height=60}Lines = load_array{'abc def'}Cursor1 = {line=1, pos=1}Margin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-right')check_eq(Cursor1.pos, 4, 'F - test_move_past_end_of_word')endfunction test_skip_to_next_word()io.write('\ntest_skip_to_next_word')App.screen.init{width=120, height=60}Lines = load_array{'abc def'}Cursor1 = {line=1, pos=4} -- at the space between wordsMargin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-right')check_eq(Cursor1.pos, 8, 'F - test_skip_to_next_word')endfunction test_move_past_end_of_word_on_next_line()io.write('\ntest_move_past_end_of_word_on_next_line')App.screen.init{width=120, height=60}Lines = load_array{'abc def', 'ghi'}Cursor1 = {line=1, pos=8}Margin_right = 0; Margin_width = Margin_leftApp.draw()App.run_after_keychord('M-right')check_eq(Cursor1.line, 2, 'F - test_move_past_end_of_word_on_next_line/line')check_eq(Cursor1.pos, 4, 'F - test_move_past_end_of_word_on_next_line/pos')end