summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2017-06-02 13:25:35 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2017-06-02 13:25:35 +0900
commit2e3dc75425d23b4d9e8e05a901395914cf8d3120 (patch)
treebaccbb0305c7337b95207945c55d5e33f726c55b /test
parent5d6eb5bfd64c6d5d773c71159d819b651dd5f7f1 (diff)
Fix inconsistent tiebreak scores when --nth is used
Make sure to consistently calculate tiebreak scores based on the original line. This change may not be preferable if you filter aligned tabular input on a subset of columns using --nth. However, if we calculate length tiebreak only on the matched components instead of the entire line, the result can be very confusing when multiple --nth components are specified, so let's keep it simple and consistent. Close #926
Diffstat (limited to 'test')
-rw-r--r--test/test_go.rb54
1 files changed, 1 insertions, 53 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index 85b8f370..3c7000b8 100644
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -683,62 +683,10 @@ class TestGoFZF < TestBase
]
assert_equal output, `#{FZF} -fh < #{tempname}`.split($/)
- output = %w[
- 1234567:h
- 12345:he
- 1:hell
- 123:hello
- ]
+ # Since 0.16.8, --nth doesn't affect --tiebreak
assert_equal output, `#{FZF} -fh -n2 -d: < #{tempname}`.split($/)
end
- def test_tiebreak_length_with_nth_trim_length
- input = [
- "apple juice bottle 1",
- "apple ui bottle 2",
- "app ice bottle 3",
- "app ic bottle 4",
- ]
- writelines tempname, input
-
- # len(1)
- output = [
- "app ice bottle 3",
- "app ic bottle 4",
- "apple juice bottle 1",
- "apple ui bottle 2",
- ]
- assert_equal output, `#{FZF} -fa -n1 < #{tempname}`.split($/)
-
- # len(1 ~ 2)
- output = [
- "app ic bottle 4",
- "app ice bottle 3",
- "apple ui bottle 2",
- "apple juice bottle 1",
- ]
- assert_equal output, `#{FZF} -fai -n1..2 < #{tempname}`.split($/)
-
- # len(1) + len(2)
- output = [
- "app ic bottle 4",
- "app ice bottle 3",
- "apple ui bottle 2",
- "apple juice bottle 1",
- ]
- assert_equal output, `#{FZF} -x -f"a i" -n1,2 < #{tempname}`.split($/)
-
- # len(2)
- output = [
- "app ic bottle 4",
- "app ice bottle 3",
- "apple ui bottle 2",
- "apple juice bottle 1",
- ]
- assert_equal output, `#{FZF} -fi -n2 < #{tempname}`.split($/)
- assert_equal output, `#{FZF} -fi -n2,1..2 < #{tempname}`.split($/)
- end
-
def test_invalid_cache
tmux.send_keys "(echo d; echo D; echo x) | #{fzf '-q d'}", :Enter
tmux.until { |lines| lines[-2].include? '2/3' }