1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[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
This commit is contained in:
aycabta 2021-02-16 01:46:53 +09:00
parent a3055a35dd
commit 7aa3bc8403
2 changed files with 16 additions and 0 deletions

View file

@ -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
}

View file

@ -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