Fix Travis CI build

This commit is contained in:
Junegunn Choi 2015-04-14 22:23:11 +09:00
parent 2d68cb8639
commit b882de87ab
2 changed files with 23 additions and 15 deletions

View File

@ -12,17 +12,13 @@ install:
- 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 ]

View File

@ -4,7 +4,9 @@
require 'minitest/autorun'
require 'fileutils'
Dir.chdir File.expand_path('../../', __FILE__)
base = File.expand_path('../../', __FILE__)
Dir.chdir base
FZF = "#{base}/bin/fzf"
class NilClass
def include? str
@ -26,7 +28,8 @@ module Temp
waited = 0
while waited < 5
begin
data = `cat #{name}`
system 'sync'
data = File.read(name)
return data unless data.empty?
rescue
sleep 0.1
@ -195,7 +198,7 @@ class TestBase < Minitest::Test
nil
end
}.compact
"fzf #{opts.join ' '}"
"#{FZF} #{opts.join ' '}"
end
end
@ -243,7 +246,7 @@ class TestGoFZF < TestBase
end
def test_key_bindings
tmux.send_keys "fzf -q 'foo bar foo-bar'", :Enter
tmux.send_keys "#{FZF} -q 'foo bar foo-bar'", :Enter
tmux.until { |lines| lines.last =~ /^>/ }
# CTRL-A
@ -472,10 +475,19 @@ class TestGoFZF < TestBase
end
def test_unicode_case
assert_equal %w[СТРОКА2 Строка4],
`ruby -e "puts %w[строКА1 СТРОКА2 строка3 Строка4]" | fzf -fС`.split($/)
assert_equal %w[строКА1 СТРОКА2 строка3 Строка4],
`ruby -e "puts %w[строКА1 СТРОКА2 строка3 Строка4]" | fzf -fс`.split($/)
tempname = TEMPNAME + Time.now.to_f.to_s
File.open(tempname, 'w') do |f|
f << %w[строКА1 СТРОКА2 строка3 Строка4].join($/)
f.sync
end
since = Time.now
while `cat #{tempname}`.split($/).length != 4 && (Time.now - since) < 10
sleep 0.1
end
assert_equal %w[СТРОКА2 Строка4], `cat #{tempname} | #{FZF} -fС`.split($/)
assert_equal %w[строКА1 СТРОКА2 строка3 Строка4], `cat #{tempname} | #{FZF} -fс`.split($/)
rescue
File.unlink tempname
end
end