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

[ruby/reline] Add a test for Reline.delete_text

https://github.com/ruby/reline/commit/d1c5700fa3
This commit is contained in:
aycabta 2021-10-11 17:28:43 +09:00 committed by git
parent 60d20e3537
commit b7ac9a2445

View file

@ -253,6 +253,25 @@ class Reline::Test < Reline::TestCase
assert_equal(3, Reline.point)
end
def test_delete_text
assert_equal('', Reline.line_buffer)
assert_equal(0, Reline.point)
Reline.insert_text('abc')
assert_equal('abc', Reline.line_buffer)
assert_equal(3, Reline.point)
Reline.delete_text()
assert_equal('', Reline.line_buffer)
assert_equal(0, Reline.point)
Reline.insert_text('abc')
Reline.delete_text(1)
assert_equal('a', Reline.line_buffer)
assert_equal(1, Reline.point)
Reline.insert_text('defghi')
Reline.delete_text(2, 2)
assert_equal('adghi', Reline.line_buffer)
assert_equal(5, Reline.point)
end
def test_input=
# TODO
assert_raise(TypeError) do