ruby-changes:67690
From: aycabta <ko1@a...>
Date: Fri, 10 Sep 2021 09:06:32 +0900 (JST)
Subject: [ruby-changes:67690] d1498f93ab (master): [ruby/reline] Add a test that dialog doesn't crash when callback returns nil
https://git.ruby-lang.org/ruby.git/commit/?id=d1498f93ab From d1498f93ab0ef48f8cf8f6ec718317dab6cd11b6 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Fri, 10 Sep 2021 08:15:00 +0900 Subject: [ruby/reline] Add a test that dialog doesn't crash when callback returns nil https://github.com/ruby/reline/commit/2c6f604b98 --- test/reline/yamatanooroti/multiline_repl | 1 + test/reline/yamatanooroti/test_rendering.rb | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/test/reline/yamatanooroti/multiline_repl b/test/reline/yamatanooroti/multiline_repl index c944da8..49c7a56 100755 --- a/test/reline/yamatanooroti/multiline_repl +++ b/test/reline/yamatanooroti/multiline_repl @@ -32,6 +32,7 @@ opt.on('--auto-indent') { https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/multiline_repl#L32 } opt.on('--dialog VAL') { |v| Reline.add_dialog_proc(:simple_dialog, lambda { + return nil if v.include?('nil') if v.include?('simple') contents = <<~RUBY.split("\n") Ruby is... diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index d105405..285a10c 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -1011,6 +1011,16 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L1011 EOC end + def test_dialog_callback_returns_nil + start_terminal(20, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --dialog nil}, startup_message: 'Multiline REPL.') + write('a') + close + assert_screen(<<~'EOC') + Multiline REPL. + prompt> a + EOC + end + def write_inputrc(content) File.open(@inputrc_file, 'w') do |f| f.write content -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/