summaryrefslogtreecommitdiff
path: root/src/pattern_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-01-11 01:15:44 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-01-11 01:30:17 +0900
commit4f4031443365659de357ad4da15af8b5e3245137 (patch)
treebe1535a7c4ebd6a5e3e0e0898c06aa4d1c5190dd /src/pattern_test.go
parentf670f4f076867d6876bcbc832a9b464bbe4f8f68 (diff)
downloadfzf-4f4031443365659de357ad4da15af8b5e3245137.tar.gz
Fix --with-nth option when query is non-empty
Diffstat (limited to 'src/pattern_test.go')
-rw-r--r--src/pattern_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/pattern_test.go b/src/pattern_test.go
index a1ce6263..a776e301 100644
--- a/src/pattern_test.go
+++ b/src/pattern_test.go
@@ -85,3 +85,21 @@ func TestCaseSensitivity(t *testing.T) {
t.Error("Invalid case conversion")
}
}
+
+func TestOrigText(t *testing.T) {
+ strptr := func(str string) *string {
+ return &str
+ }
+
+ pattern := BuildPattern(MODE_EXTENDED, CASE_SMART, []Range{}, nil, []rune("jg"))
+ for _, fun := range []func(*Chunk) []*Item{pattern.fuzzyMatch, pattern.extendedMatch} {
+ chunk := Chunk{
+ &Item{text: strptr("junegunn"), origText: strptr("junegunn.choi")},
+ }
+ matches := fun(&chunk)
+ if *matches[0].text != "junegunn" || *matches[0].origText != "junegunn.choi" ||
+ matches[0].offsets[0][0] != 0 || matches[0].offsets[0][1] != 5 {
+ t.Error("Invalid match result", matches)
+ }
+ }
+}