diff options
author | aycabta <aycabta@gmail.com> | 2021-09-02 04:31:01 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-09-02 14:07:40 +0900 |
commit | 5f23003cc204182134af2682f1de1e8801b3f423 (patch) | |
tree | 70b39a4cfef1d49a25a5ea9e51010d46cdc88981 /test/reline/yamatanooroti | |
parent | ab63f6d8543903f177c46634f38e5428655f003b (diff) |
[ruby/reline] Fix a crash when completing after 2nd line
https://github.com/ruby/reline/commit/f9d3480c34
Diffstat (limited to 'test/reline/yamatanooroti')
-rwxr-xr-x | test/reline/yamatanooroti/multiline_repl | 5 | ||||
-rw-r--r-- | test/reline/yamatanooroti/test_rendering.rb | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/reline/yamatanooroti/multiline_repl b/test/reline/yamatanooroti/multiline_repl index f2efdd4eaf..00d4825ee3 100755 --- a/test/reline/yamatanooroti/multiline_repl +++ b/test/reline/yamatanooroti/multiline_repl @@ -30,6 +30,11 @@ opt.on('--dynamic-prompt-returns-empty') { opt.on('--auto-indent') { AutoIndent.new } +opt.on('--complete') { + Reline.completion_proc = lambda { |target, preposing = nil, postposing = nil| + %w{String ScriptError SyntaxError Signal} + } +} opt.parse!(ARGV) begin diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index b17e8bbb01..0ea5b1a25d 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -809,6 +809,20 @@ begin EOC end + def test_completion_journey_2nd_line + write_inputrc <<~LINES + set editing-mode vi + LINES + start_terminal(10, 50, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --complete}, startup_message: 'Multiline REPL.') + write("def hoge\n S\C-n") + close + assert_screen(<<~'EOC') + Multiline REPL. + prompt> def hoge + prompt> String + EOC + end + def write_inputrc(content) File.open(@inputrc_file, 'w') do |f| f.write content |