Skip to content
Myr

Merge pull request #123 from junegunn/fix-travis-ci

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

Fix Travis CI build

authored by Junegunn Choi · committed by Junegunn Choi · parents 9f39671, e6a0de4 · Browse files · 2 files+33 added−16 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+33 added−16 removed

  • tests:+32 added−16 removed
  • other:+1 added−0 removed

2 files+33 added−16 removed

modified:test/test_go.rb+32 added-16 removed
36 unmodified lines
3738 attr_reader :win3940 def initialize shell = 'bash'41 @win = go("new-window -d -P -F '#I' 'PS1=FIN PROMPT_COMMAND= bash --rcfile ~/.fzf.#{shell}'").first41 @win = go("new-window -d -P -F '#I' 'PS1= PROMPT_COMMAND= bash --rcfile ~/.fzf.#{shell}'").first42 @lines = `tput lines`.chomp.to_i43 end4445 def closed?
49 unmodified lines
9596class TestGoFZF < MiniTest::Unit::TestCase97 include Temp9899 FIN = 'FIN'100 TEMPNAME = '/tmp/output'101102 attr_reader :tmux103
6 unmodified lines
110 def teardown111 @tmux.kill112 end113114 def fzf(*opts)115 opts = opts.map { |o|116 case o117 when Symbol118 o = o.to_s119 o.length > 1 ? "--#{o.gsub('_', '-')}" : "-#{o}"120 when String, Numeric121 o.to_s122 else123 nil124 end125 }.compact126 "fzf #{opts.join ' '} > #{TEMPNAME} && echo #{FIN}"127 end128129 def test_vanilla114 tmux.send_keys "seq 1 100000 | fzf > #{TEMPNAME}", :Enter130 tmux.send_keys "seq 1 100000 | #{fzf}", :Enter131 tmux.until(10) { |lines| lines.last =~ /^>/ && lines[-2] =~ /^ 100000/ }132 lines = tmux.capture133 assert_equal ' 2', lines[-4]134 assert_equal '> 1', lines[-3]
14 unmodified lines
149 assert_equal '1391', readonce.chomp150 end151152 def test_fzf_default_command137 tmux.send_keys "FZF_DEFAULT_COMMAND='echo hello' fzf > #{TEMPNAME}", :Enter153 tmux.send_keys "FZF_DEFAULT_COMMAND='echo hello' #{fzf}", :Enter154 tmux.until { |lines| lines.last =~ /^>/ }155156 tmux.send_keys :Enter157 tmux.close
66 unmodified lines
224 tmux.close225 end226227 def test_multi_order212 tmux.send_keys "seq 1 10 | fzf --multi > #{TEMPNAME}", :Enter228 tmux.send_keys "seq 1 10 | #{fzf :multi}", :Enter229 tmux.until { |lines| lines.last =~ /^>/ }230231 tmux.send_keys :Tab, :Up, :Up, :Tab, :Tab, :Tab, # 3, 2232 'C-K', 'C-K', 'C-K', 'C-K', :BTab, :BTab, # 5, 6233 :PgUp, 'C-J', :Down, :Tab, :Tab # 8, 7234 tmux.until { |lines| lines[-2].include? '(6)' }235 tmux.send_keys "C-M"220 tmux.until { |lines| lines[-1].include?('FIN') }236 tmux.until { |lines| lines[-1].include?(FIN) }237 assert_equal %w[3 2 5 6 8 7], readonce.split($/)238 tmux.close239 end240241 def test_with_nth242 [true, false].each do |multi|243 tmux.send_keys "(echo ' 1st 2nd 3rd/';244 echo ' first second third/') |229 fzf #{"--multi" if multi} -x --nth 2 --with-nth 2,-1,1 > #{TEMPNAME}",245 #{fzf multi && :multi, :x, :nth, 2, :with_nth, '2,-1,1'}",246 :Enter247 tmux.until { |lines| lines[-2].include?('2/2') }248249 # Transformed list
3 unmodified lines
253254 # However, the output must not be transformed255 if multi256 tmux.send_keys :BTab, :BTab, :Enter241 tmux.until { |lines| lines[-1].include?('FIN') }257 tmux.until { |lines| lines[-1].include?(FIN) }258 assert_equal [' 1st 2nd 3rd/', ' first second third/'], readonce.split($/)259 else260 tmux.send_keys '^', '3'261 tmux.until { |lines| lines[-2].include?('1/2') }262 tmux.send_keys :Enter247 tmux.until { |lines| lines[-1].include?('FIN') }263 tmux.until { |lines| lines[-1].include?(FIN) }264 assert_equal [' 1st 2nd 3rd/'], readonce.split($/)265 end266 end267 end268269 def test_scroll270 [true, false].each do |rev|255 tmux.send_keys "seq 1 100 | fzf #{'--reverse' if rev} > #{TEMPNAME}", :Enter271 tmux.send_keys "seq 1 100 | #{fzf rev && :reverse}", :Enter272 tmux.until { |lines| lines.include? ' 100/100' }273 tmux.send_keys *110.times.map { rev ? :Down : :Up }274 tmux.until { |lines| lines.include? '> 100' }275 tmux.send_keys :Enter260 tmux.until { |lines| lines[-1].include?('FIN') }276 tmux.until { |lines| lines[-1].include?(FIN) }277 assert_equal '100', readonce.chomp278 end279 end280281 def test_select_1266 tmux.send_keys "seq 1 100 | fzf --with-nth ..,.. --print-query -q 5555 -1 > #{TEMPNAME}", :Enter267 tmux.until { |lines| lines[-1].include?('FIN') }282 tmux.send_keys "seq 1 100 | #{fzf :with_nth, '..,..', :print_query, :q, 5555, :'1'}", :Enter283 tmux.until { |lines| lines[-1].include?(FIN) }284 assert_equal ['5555', '55'], readonce.split($/)285 end286287 def test_exit_0272 tmux.send_keys "seq 1 100 | fzf --with-nth ..,.. --print-query -q 555555 -0 > #{TEMPNAME}", :Enter273 tmux.until { |lines| lines[-1].include?('FIN') }288 tmux.send_keys "seq 1 100 | #{fzf :with_nth, '..,..', :print_query, :q, 555555, :'0'}", :Enter289 tmux.until { |lines| lines[-1].include?(FIN) }290 assert_equal ['555555'], readonce.split($/)291 end292293 def test_query_unicode278 tmux.send_keys "(echo abc; echo 가나다) | fzf --query 가다 > #{TEMPNAME}", :Enter294 tmux.send_keys "(echo abc; echo 가나다) | #{fzf :query, '가다'}", :Enter295 tmux.until { |lines| lines.last.start_with? '>' }296 tmux.send_keys :Enter281 tmux.until { |lines| lines[-1].include?('FIN') }297 tmux.until { |lines| lines[-1].include?(FIN) }298 assert_equal ['가나다'], readonce.split($/)299 end300end301
modified:.travis.yml+1 added