From 80ed02e72ee3c5d408d1b8f5a81fb43e18a87ed1 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 26 Aug 2015 23:35:31 +0900 Subject: [PATCH] Add failing test case for #329 --- test/test_go.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_go.rb b/test/test_go.rb index c21c94e..ba229bf 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -774,6 +774,16 @@ class TestGoFZF < TestBase tmux.until { |lines| lines.any? { |l| l.include? 'Invalid $TERM: xxx' } } end + def test_with_nth + writelines tempname, ['hello world ', 'byebye'] + assert_equal 'hello world ', `cat #{tempname} | #{FZF} -f"^he hehe" -x -n 2.. --with-nth 2,1,1`.chomp + end + + def test_with_nth_ansi + writelines tempname, ["\x1b[33mhello \x1b[34;1mworld\x1b[m ", 'byebye'] + assert_equal 'hello world ', `cat #{tempname} | #{FZF} -f"^he hehe" -x -n 2.. --with-nth 2,1,1 --ansi`.chomp + end + private def writelines path, lines File.unlink path while File.exists? path