summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-02-26 01:42:15 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-02-26 01:42:15 +0900
commitc1aa5c5f3380315621d30d99b258667775b0fad3 (patch)
tree5bfbff2ba5ad7ce1cb8d914106a91bf2cc2939e7 /test
parent4a1752d3fc7f069b0f8afb12ed625acb6fd2aee2 (diff)
Add --tac option and reverse display order of --no-sort
DISCLAIMER: This is a backward incompatible change
Diffstat (limited to 'test')
-rw-r--r--test/test_go.rb27
-rw-r--r--test/test_ruby.rb2
2 files changed, 26 insertions, 3 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index fe32a4ea..889ace49 100644
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -15,7 +15,7 @@ module Temp
waited = 0
while waited < 5
begin
- data = File.read(name)
+ data = `cat #{name}`
return data unless data.empty?
rescue
sleep 0.1
@@ -93,7 +93,7 @@ private
end
end
-class TestGoFZF < MiniTest::Unit::TestCase
+class TestGoFZF < Minitest::Test
include Temp
FIN = 'FIN'
@@ -322,5 +322,28 @@ class TestGoFZF < MiniTest::Unit::TestCase
tmux.send_keys 'C-K', :Enter
assert_equal ['1919'], readonce.split($/)
end
+
+ def test_tac
+ tmux.send_keys "seq 1 1000 | #{fzf :tac, :multi}", :Enter
+ tmux.until { |lines| lines[-2].include? '1000/1000' }
+ tmux.send_keys :BTab, :BTab, :BTab, :Enter
+ assert_equal %w[1000 999 998], readonce.split($/)
+ end
+
+ def test_tac_sort
+ tmux.send_keys "seq 1 1000 | #{fzf :tac, :multi}", :Enter
+ tmux.until { |lines| lines[-2].include? '1000/1000' }
+ tmux.send_keys '99'
+ tmux.send_keys :BTab, :BTab, :BTab, :Enter
+ assert_equal %w[99 999 998], readonce.split($/)
+ end
+
+ def test_tac_nosort
+ tmux.send_keys "seq 1 1000 | #{fzf :tac, :no_sort, :multi}", :Enter
+ tmux.until { |lines| lines[-2].include? '1000/1000' }
+ tmux.send_keys '00'
+ tmux.send_keys :BTab, :BTab, :BTab, :Enter
+ assert_equal %w[1000 900 800], readonce.split($/)
+ end
end
diff --git a/test/test_ruby.rb b/test/test_ruby.rb
index 674ed3be..25f923b1 100644
--- a/test/test_ruby.rb
+++ b/test/test_ruby.rb
@@ -54,7 +54,7 @@ class MockTTY
end
end
-class TestRubyFZF < MiniTest::Unit::TestCase
+class TestRubyFZF < Minitest::Test
def setup
ENV.delete 'FZF_DEFAULT_SORT'
ENV.delete 'FZF_DEFAULT_OPTS'