summaryrefslogtreecommitdiff
path: root/src/item_test.go
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 /src/item_test.go
parent4a1752d3fc7f069b0f8afb12ed625acb6fd2aee2 (diff)
downloadfzf-c1aa5c5f3380315621d30d99b258667775b0fad3.tar.gz
Add --tac option and reverse display order of --no-sort
DISCLAIMER: This is a backward incompatible change
Diffstat (limited to 'src/item_test.go')
-rw-r--r--src/item_test.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/item_test.go b/src/item_test.go
index 0e83631a..372ab4ae 100644
--- a/src/item_test.go
+++ b/src/item_test.go
@@ -20,12 +20,19 @@ func TestOffsetSort(t *testing.T) {
}
func TestRankComparison(t *testing.T) {
- if compareRanks(Rank{3, 0, 5}, Rank{2, 0, 7}) ||
- !compareRanks(Rank{3, 0, 5}, Rank{3, 0, 6}) ||
- !compareRanks(Rank{1, 2, 3}, Rank{1, 3, 2}) ||
- !compareRanks(Rank{0, 0, 0}, Rank{0, 0, 0}) {
+ if compareRanks(Rank{3, 0, 5}, Rank{2, 0, 7}, false) ||
+ !compareRanks(Rank{3, 0, 5}, Rank{3, 0, 6}, false) ||
+ !compareRanks(Rank{1, 2, 3}, Rank{1, 3, 2}, false) ||
+ !compareRanks(Rank{0, 0, 0}, Rank{0, 0, 0}, false) {
t.Error("Invalid order")
}
+
+ if compareRanks(Rank{3, 0, 5}, Rank{2, 0, 7}, true) ||
+ !compareRanks(Rank{3, 0, 5}, Rank{3, 0, 6}, false) ||
+ !compareRanks(Rank{1, 2, 3}, Rank{1, 3, 2}, true) ||
+ !compareRanks(Rank{0, 0, 0}, Rank{0, 0, 0}, false) {
+ t.Error("Invalid order (tac)")
+ }
}
// Match length, string length, index