ruby-changes:65309
From: aycabta <ko1@a...>
Date: Sun, 21 Feb 2021 07:04:12 +0900 (JST)
Subject: [ruby-changes:65309] 7aa3bc8403 (master): [ruby/reline] Add a test for suppressing crash when dynamic prompt returns empty
https://git.ruby-lang.org/ruby.git/commit/?id=7aa3bc8403 From 7aa3bc84039a1b5d9ddfc491ca32753346163dd6 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Tue, 16 Feb 2021 01:46:53 +0900 Subject: [ruby/reline] Add a test for suppressing crash when dynamic prompt returns empty ref. https://github.com/ruby/reline/pull/262 https://github.com/ruby/reline/commit/b98bc3c329 --- test/reline/yamatanooroti/multiline_repl | 3 +++ test/reline/yamatanooroti/test_rendering.rb | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/test/reline/yamatanooroti/multiline_repl b/test/reline/yamatanooroti/multiline_repl index f48c1cf..f2efdd4 100755 --- a/test/reline/yamatanooroti/multiline_repl +++ b/test/reline/yamatanooroti/multiline_repl @@ -24,6 +24,9 @@ opt.on('--broken-dynamic-prompt') { https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/multiline_repl#L24 } } } +opt.on('--dynamic-prompt-returns-empty') { + Reline.prompt_proc = proc { |l| [] } +} opt.on('--auto-indent') { AutoIndent.new } diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index b10b565..6f9a14d 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -706,6 +706,19 @@ begin https://github.com/ruby/ruby/blob/trunk/test/reline/yamatanooroti/test_rendering.rb#L706 EOC end + def test_dynamic_prompt_returns_empty + start_terminal(5, 20, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --dynamic-prompt-returns-empty}, startup_message: 'Multiline REPL.') + write("def hoge\nend\n") + close + assert_screen(<<~EOC) + Multiline REPL. + prompt> def hoge + prompt> end + => :hoge + prompt> + EOC + end + private 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/