Skip to content

Commit

Permalink
Rename the assertion to assert_line_around_cursor and remove other as…
Browse files Browse the repository at this point in the history
…sertions for line and cursor
  • Loading branch information
tompng committed Mar 24, 2024
1 parent ae1a6da commit 6376184
Show file tree
Hide file tree
Showing 3 changed files with 642 additions and 781 deletions.
26 changes: 1 addition & 25 deletions test/reline/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,7 @@ def input_raw_keys(input, convert = true)
end
end

def assert_line(expected)
expected = convert_str(expected)
assert_equal(expected, @line_editor.line)
end

def assert_cursor_line(before, after)
def assert_line_around_cursor(before, after)
before = convert_str(before)
after = convert_str(after)
line = @line_editor.line
Expand All @@ -163,25 +158,6 @@ def assert_byte_pointer_size(expected)
EOM
end

def assert_cursor(expected)
# This test satisfies nothing because there is no `@cursor` anymore
# Test editor_cursor_position instead
cursor_x = @line_editor.instance_eval do
line_before_cursor = whole_lines[@line_index].byteslice(0, @byte_pointer)
Reline::Unicode.calculate_width(line_before_cursor)
end
assert_equal(expected, cursor_x)
end

def assert_cursor_max(expected)
# This test satisfies nothing because there is no `@cursor_max` anymore
cursor_max = @line_editor.instance_eval do
line = whole_lines[@line_index]
Reline::Unicode.calculate_width(line)
end
assert_equal(expected, cursor_max)
end

def assert_line_index(expected)
assert_equal(expected, @line_editor.instance_variable_get(:@line_index))
end
Expand Down
Loading

0 comments on commit 6376184

Please sign in to comment.