mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Add a test that dialog doesn't crash when callback returns nil
2c6f604b98
This commit is contained in:
parent
b00522608f
commit
d1498f93ab
2 changed files with 11 additions and 0 deletions
|
@ -32,6 +32,7 @@ opt.on('--auto-indent') {
|
||||||
}
|
}
|
||||||
opt.on('--dialog VAL') { |v|
|
opt.on('--dialog VAL') { |v|
|
||||||
Reline.add_dialog_proc(:simple_dialog, lambda {
|
Reline.add_dialog_proc(:simple_dialog, lambda {
|
||||||
|
return nil if v.include?('nil')
|
||||||
if v.include?('simple')
|
if v.include?('simple')
|
||||||
contents = <<~RUBY.split("\n")
|
contents = <<~RUBY.split("\n")
|
||||||
Ruby is...
|
Ruby is...
|
||||||
|
|
|
@ -1011,6 +1011,16 @@ begin
|
||||||
EOC
|
EOC
|
||||||
end
|
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)
|
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