diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2015-05-10 03:25:14 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-05-10 03:25:14 +0900 |
| commit | 683abb86efe910d656fc95005e74a3888b49541b (patch) | |
| tree | 0225647e8bff9aa9a358c9cf1a366a391ee9baf7 | |
| parent | 207aa07891e480bb18a1bc790ea6d9560b24b696 (diff) | |
| download | fzf-683abb86efe910d656fc95005e74a3888b49541b.tar.gz | |
Dump screen content on test failure
| -rw-r--r-- | test/test_go.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/test/test_go.rb b/test/test_go.rb index 7f25eb12..aa49a36d 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -111,14 +111,22 @@ class Tmux def until pane = 0 lines = nil - wait do - lines = capture(pane) - class << lines - def item_count - self[-2] ? self[-2].strip.split('/').last.to_i : 0 + begin + wait do + lines = capture(pane) + class << lines + def item_count + self[-2] ? self[-2].strip.split('/').last.to_i : 0 + end end + yield lines end - yield lines + 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 } |
