1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/reline] Add encoding info to an assertion of editing line

https://github.com/ruby/reline/commit/22d9262d79
This commit is contained in:
aycabta 2021-12-24 11:04:07 +09:00 committed by git
parent cf83ba1da7
commit ae770cc372

View file

@ -85,9 +85,13 @@ class Reline::TestCase < Test::Unit::TestCase
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)