mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/reline] Add a test for simple dialog
https://github.com/ruby/reline/commit/d70f507e2c
This commit is contained in:
parent
4475953378
commit
364e646317
2 changed files with 32 additions and 0 deletions
|
@ -30,6 +30,19 @@ opt.on('--dynamic-prompt-returns-empty') {
|
|||
opt.on('--auto-indent') {
|
||||
AutoIndent.new
|
||||
}
|
||||
opt.on('--simple-dialog') {
|
||||
Reline.add_dialog_proc(:simple_dialog, lambda {
|
||||
contents = <<~RUBY.split("\n")
|
||||
Ruby is...
|
||||
A dynamic, open source programming
|
||||
language with a focus on simplicity
|
||||
and productivity. It has an elegant
|
||||
syntax that is natural to read and
|
||||
easy to write.
|
||||
RUBY
|
||||
Reline::DialogRenderInfo.new(pos: cursor_pos, contents: contents)
|
||||
})
|
||||
}
|
||||
opt.on('--complete') {
|
||||
Reline.completion_proc = lambda { |target, preposing = nil, postposing = nil|
|
||||
%w{String ScriptError SyntaxError Signal}
|
||||
|
|
|
@ -835,6 +835,25 @@ begin
|
|||
EOC
|
||||
end
|
||||
|
||||
def test_simple_dialog
|
||||
start_terminal(20, 50, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --simple-dialog}, startup_message: 'Multiline REPL.')
|
||||
write('a')
|
||||
write('b')
|
||||
write('c')
|
||||
write("\C-h")
|
||||
close
|
||||
assert_screen(<<~'EOC')
|
||||
Multiline REPL.
|
||||
prompt> ab
|
||||
Ruby is...
|
||||
A dynamic, open source programming
|
||||
language with a focus on simplicity
|
||||
and productivity. It has an elegant
|
||||
syntax that is natural to read and
|
||||
easy to write.
|
||||
EOC
|
||||
end
|
||||
|
||||
def test_autocomplete
|
||||
start_terminal(20, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.')
|
||||
write("Stri")
|
||||
|
|
Loading…
Add table
Reference in a new issue