diff options
author | aycabta <aycabta@gmail.com> | 2021-02-16 01:46:53 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2021-02-21 06:43:31 +0900 |
commit | 7aa3bc84039a1b5d9ddfc491ca32753346163dd6 (patch) | |
tree | 1b3978b2e02706ef15ad5277d3e38ec513a6764d | |
parent | a3055a35dd7b8b6520d5fe599d1c67490c556a3c (diff) |
[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
-rwxr-xr-x | test/reline/yamatanooroti/multiline_repl | 3 | ||||
-rw-r--r-- | test/reline/yamatanooroti/test_rendering.rb | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/reline/yamatanooroti/multiline_repl b/test/reline/yamatanooroti/multiline_repl index f48c1cfbd9..f2efdd4eaf 100755 --- a/test/reline/yamatanooroti/multiline_repl +++ b/test/reline/yamatanooroti/multiline_repl @@ -24,6 +24,9 @@ opt.on('--broken-dynamic-prompt') { } } } +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 b10b565212..6f9a14de67 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -706,6 +706,19 @@ begin 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 |