Dump screen content on test failure

This commit is contained in:
Junegunn Choi 2015-05-10 03:25:14 +09:00
parent 207aa07891
commit 683abb86ef

View File

@ -111,6 +111,7 @@ class Tmux
def until pane = 0
lines = nil
begin
wait do
lines = capture(pane)
class << lines
@ -120,6 +121,13 @@ class Tmux
end
yield lines
end
rescue Exception
puts $!.backtrace
puts '>' * 80
puts lines
puts '<' * 80
raise
end
lines
end
@ -527,7 +535,7 @@ module TestShell
def test_ctrl_t
tmux.prepare
tmux.send_keys 'C-t', pane: 0
lines = tmux.until(1) { |lines| lines.item_count > 0 }
lines = tmux.until(1) { |lines| lines.item_count > 1 }
expected = lines.values_at(-3, -4).map { |line| line[2..-1] }.join(' ')
tmux.send_keys :BTab, :BTab, :Enter, pane: 1
tmux.until(0) { |lines| lines[-1].include? expected }
@ -536,7 +544,7 @@ module TestShell
# FZF_TMUX=0
new_shell
tmux.send_keys 'C-t', pane: 0
lines = tmux.until(0) { |lines| lines.item_count > 0 }
lines = tmux.until(0) { |lines| lines.item_count > 1 }
expected = lines.values_at(-3, -4).map { |line| line[2..-1] }.join(' ')
tmux.send_keys :BTab, :BTab, :Enter, pane: 0
tmux.until(0) { |lines| lines[-1].include? expected }