Skip to content
Myr

Fix Travis-CI build

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent ae3180f · Browse files · 2 files+30 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+30 added−15 removed

  • tests:+15 added−6 removed
  • other:+15 added−9 removed

2 files+30 added−15 removed

modified:test/test_go.rb+15 added-6 removed
8 unmodified lines
9 attr_reader :win1011 def initialize shell = 'bash'12 @win = go("new-window -P -F '#I' 'bash --rcfile ~/.fzf.#{shell}'").first13 @lines = `tput lines`.chomp.to_i14 end1516 def self.current17 `tmux display-message -p '#I'`.split($/).first
7 unmodified lines
25 !go("list-window -F '#I'").include?(win)26 end2728 def close timeout = 128 send_keys 'C-c', 'C-u', 'C-d'29 send_keys 'C-c', 'C-u', 'exit', :Enter30 wait(timeout) { closed? }31 end3233 def kill
7 unmodified lines
4142 def capture43 go("capture-pane -t #{win} \\; save-buffer #{TEMPNAME}")44 raise "Window not found" if $?.exitstatus != 044 File.read(TEMPNAME).split($/)45 File.read(TEMPNAME).split($/)[0, @lines]46 end4748 def until timeout = 149 wait(timeout) { yield capture }
4 unmodified lines
54 waited = 055 until yield56 waited += 0.157 sleep 0.157 raise "timeout" if waited > timeout58 if waited > timeout59 hl = '=' * 1060 puts hl61 capture.each_with_index do |line, idx|62 puts [idx.to_s.rjust(2), line].join(': ')63 end64 puts hl65 raise "timeout"66 end67 end68 end6970 def go *args
22 unmodified lines
93 end9495 def test_vanilla96 tmux.send_keys "seq 1 100000 | fzf > #{tempname}", :Enter88 tmux.until { |lines| lines.last =~ /^>/ && lines[-2] =~ /^ 100000/ }97 tmux.until(10) { |lines| lines.last =~ /^>/ && lines[-2] =~ /^ 100000/ }98 lines = tmux.capture99 assert_equal ' 2', lines[-4]100 assert_equal '> 1', lines[-3]101 assert_equal ' 100000/100000', lines[-2]102 assert_equal '>', lines[-1]103104 # Testing basic key bindings105 tmux.send_keys '99', 'C-a', '1', 'C-f', '3', 'C-b', 'C-h', 'C-u', 'C-e', 'C-y', 'C-k', 'Tab', 'BTab'97 tmux.until { |lines| lines.last == '> 391' }106 tmux.until { |lines| lines[-2] == ' 856/100000' }107 lines = tmux.capture108 assert_equal '> 1391', lines[-4]109 assert_equal ' 391', lines[-3]110 assert_equal ' 856/100000', lines[-2]
14 unmodified lines
125 end126127 def test_fzf_prompt128 tmux.send_keys "fzf -q 'foo bar foo-bar'", :Enter120 tmux.until { |lines| lines.last =~ /foo-bar/ }129 tmux.until { |lines| lines.last =~ /^>/ }130131 # CTRL-A132 tmux.send_keys "C-A", "("133 tmux.until { |lines| lines.last == '> (foo bar foo-bar' }
60 unmodified lines
modified:.travis.yml+15 added-9 removed