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
b98bc3c329
This commit is contained in:
parent
a3055a35dd
commit
7aa3bc8403
2 changed files with 16 additions and 0 deletions
|
@ -24,6 +24,9 @@ opt.on('--broken-dynamic-prompt') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
opt.on('--dynamic-prompt-returns-empty') {
|
||||||
|
Reline.prompt_proc = proc { |l| [] }
|
||||||
|
}
|
||||||
opt.on('--auto-indent') {
|
opt.on('--auto-indent') {
|
||||||
AutoIndent.new
|
AutoIndent.new
|
||||||
}
|
}
|
||||||
|
|
|
@ -706,6 +706,19 @@ begin
|
||||||
EOC
|
EOC
|
||||||
end
|
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)
|
private def write_inputrc(content)
|
||||||
File.open(@inputrc_file, 'w') do |f|
|
File.open(@inputrc_file, 'w') do |f|
|
||||||
f.write content
|
f.write content
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue