Skip to content

Commit d70f507

Browse files
committed
Add a test for simple dialog
1 parent 2173114 commit d70f507

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

test/reline/yamatanooroti/multiline_repl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ opt.on('--dynamic-prompt-returns-empty') {
3030
opt.on('--auto-indent') {
3131
AutoIndent.new
3232
}
33+
opt.on('--simple-dialog') {
34+
Reline.add_dialog_proc(:simple_dialog, lambda {
35+
contents = <<~RUBY.split("\n")
36+
Ruby is...
37+
A dynamic, open source programming
38+
language with a focus on simplicity
39+
and productivity. It has an elegant
40+
syntax that is natural to read and
41+
easy to write.
42+
RUBY
43+
Reline::DialogRenderInfo.new(pos: cursor_pos, contents: contents)
44+
})
45+
}
3346
opt.on('--complete') {
3447
Reline.completion_proc = lambda { |target, preposing = nil, postposing = nil|
3548
%w{String ScriptError SyntaxError Signal}

test/reline/yamatanooroti/test_rendering.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,25 @@ def test_completion_journey_with_empty_line
835835
EOC
836836
end
837837

838+
def test_simple_dialog
839+
start_terminal(20, 50, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --simple-dialog}, startup_message: 'Multiline REPL.')
840+
write('a')
841+
write('b')
842+
write('c')
843+
write("\C-h")
844+
close
845+
assert_screen(<<~'EOC')
846+
Multiline REPL.
847+
prompt> ab
848+
Ruby is...
849+
A dynamic, open source programming
850+
language with a focus on simplicity
851+
and productivity. It has an elegant
852+
syntax that is natural to read and
853+
easy to write.
854+
EOC
855+
end
856+
838857
def test_autocomplete
839858
start_terminal(20, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.')
840859
write("Stri")

0 commit comments

Comments
 (0)