From b7ac9a2445a0b217ec4c2db9b712bba84ebff575 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 11 Oct 2021 17:28:43 +0900 Subject: [PATCH] [ruby/reline] Add a test for Reline.delete_text https://github.com/ruby/reline/commit/d1c5700fa3 --- test/reline/test_reline.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/reline/test_reline.rb b/test/reline/test_reline.rb index 61d986d076..e91c8dc1e8 100644 --- a/test/reline/test_reline.rb +++ b/test/reline/test_reline.rb @@ -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