Skip to content

Commit

Permalink
Use assert_cursor_line and remove other assertions for line and cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
tompng committed Mar 19, 2024
1 parent 9f0efcc commit cf16222
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 300 deletions.
24 changes: 0 additions & 24 deletions test/reline/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ 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)
before = convert_str(before)
after = convert_str(after)
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 cf16222

Please sign in to comment.