Skip to content

Commit

Permalink
Add encoding info to an assertion of editing line
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Dec 24, 2021
1 parent a5d8a6c commit 22d9262
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/reline/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ def assert_line(expected)
def assert_byte_pointer_size(expected)
expected = convert_str(expected)
byte_pointer = @line_editor.instance_variable_get(:@byte_pointer)
chunk = @line_editor.line.byteslice(0, byte_pointer)
assert_equal(
expected.bytesize, byte_pointer,
"<#{expected.inspect}> expected but was\n<#{@line_editor.line.byteslice(0, byte_pointer).inspect}>")
<<~EOM)
<#{expected.inspect} (#{expected.encoding.inspect})> expected but was
<#{chunk.inspect} (#{chunk.encoding.inspect})> in <Terminal #{Reline::GeneralIO.encoding.inspect}>
EOM
end

def assert_cursor(expected)
Expand Down

0 comments on commit 22d9262

Please sign in to comment.