diff options
| author | tomoya ishida <tomoyapenguin@gmail.com> | 2024-04-18 01:12:14 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-04-17 16:12:20 +0000 |
| commit | 15b659ca932254102ee3706aefa7a04d5c43969e (patch) | |
| tree | 43d57fe71924236798a28572d57de42d5e701965 /test | |
| parent | 8c8068c06fd149659bd1d42315f8206b91defdf9 (diff) | |
[ruby/reline] Refactor nomultiline and multiline mode difference
(https://github.com/ruby/reline/pull/653)
* Support multiline input in Reline.readline internally, reduce multiline-singleline branch
* Add readline(singleline) prompt test with force inserting multiline text
https://github.com/ruby/reline/commit/97846095d7
Diffstat (limited to 'test')
| -rw-r--r-- | test/reline/helper.rb | 2 | ||||
| -rw-r--r-- | test/reline/yamatanooroti/test_rendering.rb | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/test/reline/helper.rb b/test/reline/helper.rb index f2f3421ded..26fe834482 100644 --- a/test/reline/helper.rb +++ b/test/reline/helper.rb @@ -131,7 +131,7 @@ class Reline::TestCase < Test::Unit::TestCase def assert_line_around_cursor(before, after) before = convert_str(before) after = convert_str(after) - line = @line_editor.line + line = @line_editor.current_line byte_pointer = @line_editor.instance_variable_get(:@byte_pointer) actual_before = line.byteslice(0, byte_pointer) actual_after = line.byteslice(byte_pointer..) diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index fe0f8842ea..09d064934a 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -309,6 +309,21 @@ begin EOC end + def test_readline_with_multiline_input + start_terminal(5, 50, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --dynamic-prompt}, startup_message: 'Multiline REPL.') + write("def foo\n bar\nend\n") + write("Reline.readline('prompt> ')\n") + write("\C-p\C-p") + close + assert_screen(<<~EOC) + => :foo + [0000]> Reline.readline('prompt> ') + prompt> def foo + bar + end + EOC + end + def test_multiline_and_autowrap start_terminal(10, 20, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.') write("def aaaaaaaaaa\n 33333333\n end\C-a\C-pputs\C-e\e\C-m888888888888888") |
