more streamlined test names

https://lobste.rs/messages/e1rimy
This commit is contained in:
Kartik K. Agaram 2022-12-13 09:43:55 -08:00
parent 2dd2b16295
commit 03be29885f
1 changed files with 29 additions and 29 deletions

View File

@ -267,8 +267,8 @@ function test_move_past_end_of_word_on_next_line()
check_eq(Editor_state.cursor1.pos, 4, 'F - test_move_past_end_of_word_on_next_line/pos')
end
function test_click_with_mouse()
io.write('\ntest_click_with_mouse')
function test_click_moves_cursor()
io.write('\ntest_click_moves_cursor')
App.screen.init{width=50, height=60}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abc', 'def', 'xyz'}
@ -279,15 +279,15 @@ function test_click_with_mouse()
Editor_state.selection1 = {}
edit.draw(Editor_state) -- populate line_cache.starty for each line Editor_state.line_cache
edit.run_after_mouse_release(Editor_state, Editor_state.left+8,Editor_state.top+5, 1)
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_with_mouse/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_with_mouse/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_moves_cursor/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_moves_cursor/cursor:pos')
-- selection is empty to avoid perturbing future edits
check_nil(Editor_state.selection1.line, 'F - test_click_with_mouse/selection:line')
check_nil(Editor_state.selection1.pos, 'F - test_click_with_mouse/selection:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_moves_cursor/selection:line')
check_nil(Editor_state.selection1.pos, 'F - test_click_moves_cursor/selection:pos')
end
function test_click_with_mouse_to_left_of_line()
io.write('\ntest_click_with_mouse_to_left_of_line')
function test_click_to_left_of_line()
io.write('\ntest_click_to_left_of_line')
-- display a line with the cursor in the middle
App.screen.init{width=50, height=80}
Editor_state = edit.initialize_test_state()
@ -300,13 +300,13 @@ function test_click_with_mouse_to_left_of_line()
edit.draw(Editor_state)
edit.run_after_mouse_click(Editor_state, Editor_state.left-4,Editor_state.top+5, 1)
-- cursor moves to start of line
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_with_mouse_to_left_of_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_click_with_mouse_to_left_of_line/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_with_mouse_to_left_of_line/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_to_left_of_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'F - test_click_to_left_of_line/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_to_left_of_line/selection is empty to avoid perturbing future edits')
end
function test_click_with_mouse_takes_margins_into_account()
io.write('\ntest_click_with_mouse_takes_margins_into_account')
function test_click_takes_margins_into_account()
io.write('\ntest_click_takes_margins_into_account')
-- display two lines with cursor on one of them
App.screen.init{width=100, height=80}
Editor_state = edit.initialize_test_state()
@ -320,13 +320,13 @@ function test_click_with_mouse_takes_margins_into_account()
edit.draw(Editor_state)
edit.run_after_mouse_click(Editor_state, Editor_state.left+8,Editor_state.top+5, 1)
-- cursor moves
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_with_mouse_takes_margins_into_account/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_with_mouse_takes_margins_into_account/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_with_mouse_takes_margins_into_account/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_takes_margins_into_account/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_takes_margins_into_account/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_takes_margins_into_account/selection is empty to avoid perturbing future edits')
end
function test_click_with_mouse_on_empty_line()
io.write('\ntest_click_with_mouse_on_empty_line')
function test_click_on_empty_line()
io.write('\ntest_click_on_empty_line')
-- display two lines with the first one empty
App.screen.init{width=50, height=80}
Editor_state = edit.initialize_test_state()
@ -339,7 +339,7 @@ function test_click_with_mouse_on_empty_line()
edit.draw(Editor_state)
edit.run_after_mouse_click(Editor_state, Editor_state.left+8,Editor_state.top+5, 1)
-- cursor moves
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_with_mouse_on_empty_line/cursor')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_empty_line/cursor')
end
function test_draw_text()
@ -396,8 +396,8 @@ function test_draw_word_wrapping_text()
App.screen.check(y, 'ghi', 'F - test_draw_word_wrapping_text/screen:3')
end
function test_click_with_mouse_on_wrapping_line()
io.write('\ntest_click_with_mouse_on_wrapping_line')
function test_click_on_wrapping_line()
io.write('\ntest_click_on_wrapping_line')
-- display two lines with cursor on one of them
App.screen.init{width=50, height=80}
Editor_state = edit.initialize_test_state()
@ -410,13 +410,13 @@ function test_click_with_mouse_on_wrapping_line()
edit.draw(Editor_state)
edit.run_after_mouse_click(Editor_state, Editor_state.left+8,Editor_state.top+5, 1)
-- cursor moves
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_with_mouse_on_wrapping_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_with_mouse_on_wrapping_line/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_with_mouse_on_wrapping_line/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_wrapping_line/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_on_wrapping_line/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_on_wrapping_line/selection is empty to avoid perturbing future edits')
end
function test_click_with_mouse_on_wrapping_line_takes_margins_into_account()
io.write('\ntest_click_with_mouse_on_wrapping_line_takes_margins_into_account')
function test_click_on_wrapping_line_takes_margins_into_account()
io.write('\ntest_click_on_wrapping_line_takes_margins_into_account')
-- display two lines with cursor on one of them
App.screen.init{width=100, height=80}
Editor_state = edit.initialize_test_state()
@ -430,9 +430,9 @@ function test_click_with_mouse_on_wrapping_line_takes_margins_into_account()
edit.draw(Editor_state)
edit.run_after_mouse_click(Editor_state, Editor_state.left+8,Editor_state.top+5, 1)
-- cursor moves
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_with_mouse_on_wrapping_line_takes_margins_into_account/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_with_mouse_on_wrapping_line_takes_margins_into_account/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_with_mouse_on_wrapping_line_takes_margins_into_account/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_wrapping_line_takes_margins_into_account/cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'F - test_click_on_wrapping_line_takes_margins_into_account/cursor:pos')
check_nil(Editor_state.selection1.line, 'F - test_click_on_wrapping_line_takes_margins_into_account/selection is empty to avoid perturbing future edits')
end
function test_draw_text_wrapping_within_word()