summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-04-14 22:23:11 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-04-15 01:58:39 +0900
commitb882de87ab4bbd303dbcd7e5d928862b509a09d1 (patch)
tree711f0aa8f3c0118d78cd551c9aef1ac93e0e8e14 /test
parent2d68cb8639a78ec6b7e88dd71e2ce1a638e5f8ea (diff)
Fix Travis CI build
Diffstat (limited to 'test')
-rw-r--r--test/test_go.rb28
1 files changed, 20 insertions, 8 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index d98ab8bd..a9284b66 100644
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -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