summaryrefslogtreecommitdiff
path: root/test/reline/test_string_processing.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2025-01-23 16:13:13 +0900
committerHiroshi SHIBATA <[email protected]>2025-01-24 15:46:46 +0900
commit0fdc9b9fd168f9d25d78c79a9e970be7d0967363 (patch)
tree6a7b0bc8b9f94fdcb609689c1b644dcfa0c43d36 /test/reline/test_string_processing.rb
parent881924f2593e89e5ef78a73a4e14948a66ca0e08 (diff)
Migrate irb and reline to the bundled gems
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12624
Diffstat (limited to 'test/reline/test_string_processing.rb')
-rw-r--r--test/reline/test_string_processing.rb46
1 files changed, 0 insertions, 46 deletions
diff --git a/test/reline/test_string_processing.rb b/test/reline/test_string_processing.rb
deleted file mode 100644
index a105be9aba..0000000000
--- a/test/reline/test_string_processing.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-require_relative 'helper'
-
-class Reline::LineEditor::StringProcessingTest < Reline::TestCase
- def setup
- Reline.send(:test_mode)
- @prompt = '> '
- @config = Reline::Config.new
- Reline::HISTORY.instance_variable_set(:@config, @config)
- @line_editor = Reline::LineEditor.new(@config)
- @line_editor.reset(@prompt)
- end
-
- def teardown
- Reline.test_reset
- end
-
- def test_calculate_width
- width = @line_editor.send(:calculate_width, 'Ruby string')
- assert_equal('Ruby string'.size, width)
- end
-
- def test_calculate_width_with_escape_sequence
- width = @line_editor.send(:calculate_width, "\1\e[31m\2RubyColor\1\e[34m\2 default string \1\e[m\2>", true)
- assert_equal('RubyColor default string >'.size, width)
- end
-
- def test_completion_proc_with_preposing_and_postposing
- buf = ['def hoge', ' puts :aaa', 'end']
-
- @line_editor.instance_variable_set(:@is_multiline, true)
- @line_editor.instance_variable_set(:@buffer_of_lines, buf)
- @line_editor.instance_variable_set(:@byte_pointer, 6)
- @line_editor.instance_variable_set(:@line_index, 1)
- completion_proc_called = false
- @line_editor.instance_variable_set(:@completion_proc, proc { |target, pre, post|
- assert_equal('puts', target)
- assert_equal("def hoge\n ", pre)
- assert_equal(" :aaa\nend", post)
- completion_proc_called = true
- })
-
- assert_equal(["def hoge\n ", 'puts', " :aaa\nend", nil], @line_editor.retrieve_completion_block)
- @line_editor.__send__(:call_completion_proc, "def hoge\n ", 'puts', " :aaa\nend", nil)
- assert(completion_proc_called)
- end
-end