Skip to content

Commit

Permalink
Concatenate some rendeing test
Browse files Browse the repository at this point in the history
Some test should be concatenated for readability.
Example: undo test and undo_and_redo test can be concatenated.
  • Loading branch information
tompng committed Sep 9, 2024
1 parent 6e7198b commit 4e331cc
Showing 1 changed file with 4 additions and 98 deletions.
102 changes: 4 additions & 98 deletions test/reline/yamatanooroti/test_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def test_bracketed_paste
close
end

def test_bracketed_paste_with_undo
def test_bracketed_paste_with_undo_redo
omit if Reline.core.io_gate.win?
start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
write("abc")
Expand All @@ -566,15 +566,6 @@ def test_bracketed_paste_with_undo
Multiline REPL.
prompt> abc
EOC
close
end

def test_bracketed_paste_with_redo
omit if Reline.core.io_gate.win?
start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
write("abc")
write("\e[200~def hoge\r\t3\rend\e[201~")
write("\C-_")
write("\M-\C-_")
assert_screen(<<~EOC)
Multiline REPL.
Expand Down Expand Up @@ -639,46 +630,6 @@ def each_top_level_statement
prompt> end
prompt> end
EOC
close
end

def test_longer_than_screen_height_with_scroll_back
start_terminal(5, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
write(<<~EOC.chomp)
def each_top_level_statement
initialize_input
catch(:TERM_INPUT) do
loop do
begin
prompt
unless l = lex
throw :TERM_INPUT if @line == ''
else
@line_no += l.count("\n")
next if l == "\n"
@line.concat l
if @code_block_open or @ltype or @continue or @indent > 0
next
end
end
if @line != "\n"
@line.force_encoding(@io.encoding)
yield @line, @exp_line_no
end
break if @io.eof?
@line = ''
@exp_line_no = @line_no
#
@indent = 0
rescue TerminateLineInput
initialize_input
prompt
end
end
end
end
EOC
sleep 1
write("\C-p" * 6)
assert_screen(<<~EOC)
prompt> rescue Terminate
Expand All @@ -687,49 +638,9 @@ def each_top_level_statement
ut
prompt> prompt
EOC
close
end

def test_longer_than_screen_height_with_complex_scroll_back
start_terminal(4, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
write(<<~EOC.chomp)
def each_top_level_statement
initialize_input
catch(:TERM_INPUT) do
loop do
begin
prompt
unless l = lex
throw :TERM_INPUT if @line == ''
else
@line_no += l.count("\n")
next if l == "\n"
@line.concat l
if @code_block_open or @ltype or @continue or @indent > 0
next
end
end
if @line != "\n"
@line.force_encoding(@io.encoding)
yield @line, @exp_line_no
end
break if @io.eof?
@line = ''
@exp_line_no = @line_no
#
@indent = 0
rescue TerminateLineInput
initialize_input
prompt
end
end
end
end
EOC
sleep 1
write("\C-p" * 5)
write("\C-n" * 3)
write("\C-n" * 4)
assert_screen(<<~EOC)
prompt> initialize_inp
ut
prompt> prompt
prompt> end
Expand Down Expand Up @@ -1459,12 +1370,7 @@ def test_autocomplete_long_with_scrollbar
Socket
StringIO
EOC
close
end

def test_autocomplete_long_with_scrollbar_scroll
start_terminal(20, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete-long}, startup_message: 'Multiline REPL.')
write('S' + "\C-i" * 16)
write("\C-i" * 16)
assert_screen(<<~'EOC')
Multiline REPL.
prompt> StringScanner
Expand Down

0 comments on commit 4e331cc

Please sign in to comment.