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 2d68cb8 · Browse files · 2 files·+23 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+23 added−15 removed
- tests:+20 added−8 removed
- other:+3 added−7 removed
Provenance
- Commit
b882de8- Tree
711f0aa- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
2d68cb8
2 files changed+23 added−15 removed
modified:test/test_go.rb+20 added-8 removed
2 unmodified lines3 4 require 'minitest/autorun'5 require 'fileutils'6 7-Dir.chdir File.expand_path('../../', __FILE__)7+base = File.expand_path('../../', __FILE__)8+Dir.chdir base9+FZF = "#{base}/bin/fzf"10 11 class NilClass12 def include? str13 false13 unmodified lines27 name = self.class::TEMPNAME28 waited = 029 while waited < 530 begin29- data = `cat #{name}`31+ system 'sync'32+ data = File.read(name)33 return data unless data.empty?34 rescue35 sleep 0.136 waited += 0.1160 unmodified lines197 else198 nil199 end200 }.compact198- "fzf #{opts.join ' '}"201+ "#{FZF} #{opts.join ' '}"202 end203 end204 205 class TestGoFZF < TestBase39 unmodified lines245 assert_equal 'hello', readonce.chomp246 end247 248 def test_key_bindings246- tmux.send_keys "fzf -q 'foo bar foo-bar'", :Enter249+ tmux.send_keys "#{FZF} -q 'foo bar foo-bar'", :Enter250 tmux.until { |lines| lines.last =~ /^>/ }251 252 # CTRL-A253 tmux.send_keys "C-A", "("220 unmodified lines474 assert_equal ['111', '11'], readonce.split($/)475 end476 477 def test_unicode_case475- assert_equal %w[СТРОКА2 Строка4],476- `ruby -e "puts %w[строКА1 СТРОКА2 строка3 Строка4]" | fzf -fС`.split($/)477- assert_equal %w[строКА1 СТРОКА2 строка3 Строка4],478- `ruby -e "puts %w[строКА1 СТРОКА2 строка3 Строка4]" | fzf -fс`.split($/)478+ tempname = TEMPNAME + Time.now.to_f.to_s479+ File.open(tempname, 'w') do |f|480+ f << %w[строКА1 СТРОКА2 строка3 Строка4].join($/)481+ f.sync482+ end483+ since = Time.now484+ while `cat #{tempname}`.split($/).length != 4 && (Time.now - since) < 10485+ sleep 0.1486+ end487+ assert_equal %w[СТРОКА2 Строка4], `cat #{tempname} | #{FZF} -fС`.split($/)488+ assert_equal %w[строКА1 СТРОКА2 строка3 Строка4], `cat #{tempname} | #{FZF} -fс`.split($/)489+ rescue490+ File.unlink tempname491 end492 end493 494 module TestShell156 unmodified linesmodified:.travis.yml+3 added-7 removed
10 unmodified lines11121314151517161719181920222324212227232410 unmodified lines- sudo apt-get install -y tmux=1.9a-1~ppa1~p- sudo apt-get install -y zsh fish
script: | export GOROOT=~/go1.4 export GOPATH=~/go export FZF_BASE=~/go/src/github.com/junegunn/fzf export FZF_BASE=$GOPATH/src/github.com/junegunn/fzf
mkdir -p ~/go/src/github.com/junegunn mkdir -p $GOPATH/src/github.com/junegunn ln -s $(pwd) $FZF_BASE
curl https://storage.googleapis.com/golang/go1.4.1.linux-amd64.tar.gz | tar -xz mv go $GOROOT
cd $FZF_BASE/src && make test fzf/fzf-linux_amd64 install && cd $FZF_BASE/bin && ln -sf fzf-linux_amd64 fzf-$(./fzf --version)-linux_amd64 && cd $FZF_BASE && yes | ./install && cd $FZF_BASE && yes | ./install && rm -f fzf && tmux new "ruby test/test_go.rb > out && touch ok" && cat out && [ -e ok ]