Check gofmt in `make test`
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent c256442 · Browse files · 6 files·+13 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+13 added−12 removed
- other:+13 added−12 removed
Provenance
- Commit
bb0502f- Tree
d2ec8db- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
c256442
6 files changed+13 added−12 removed
modified:src/cache_test.go+2 added-2 removed
4 unmodified lines5 func TestChunkCache(t *testing.T) {6 cache := NewChunkCache()7 chunk1p := &Chunk{}8 chunk2p := &Chunk{count: chunkSize}9- items1 := []Result{Result{}}10- items2 := []Result{Result{}, Result{}}9+ items1 := []Result{{}}10+ items2 := []Result{{}, {}}11 cache.Add(chunk1p, "foo", items1)12 cache.Add(chunk2p, "foo", items1)13 cache.Add(chunk2p, "bar", items2)14 25 unmodified linesmodified:src/options_test.go+1 added-1 removed
100 unmodified lines101 if len(opts.Nth) != 0 {102 t.Errorf("nth should be empty: %v", opts.Nth)103 }104 }105- for _, words := range [][]string{[]string{"--nth", "..,3", "+x"}, []string{"--nth", "3,1..", "+x"}, []string{"--nth", "..-1,1", "+x"}} {105+ for _, words := range [][]string{{"--nth", "..,3", "+x"}, {"--nth", "3,1..", "+x"}, {"--nth", "..-1,1", "+x"}} {106 {107 opts := defaultOptions()108 parseOptions(opts, words)109 postProcessOptions(opts)348 unmodified linesmodified:src/pattern_test.go+1 added-1 removed
129 unmodified lines130 131 func TestOrigTextAndTransformed(t *testing.T) {132 pattern := BuildPattern(true, algo.FuzzyMatchV2, true, CaseSmart, false, true, true, []Range{}, Delimiter{}, []rune("jg"))133 tokens := Tokenize("junegunn", Delimiter{})134- trans := Transform(tokens, []Range{Range{1, 1}})134+ trans := Transform(tokens, []Range{{1, 1}})135 136 origBytes := []byte("junegunn.choi")137 for _, extended := range []bool{false, true} {138 chunk := Chunk{count: 1}71 unmodified linesmodified:src/pattern.go+2 added-2 removed
335 unmodified lines336 337 func (p *Pattern) basicMatch(item *Item, withPos bool, slab *util.Slab) (Offset, int, *[]int) {338 var input []Token339 if len(p.nth) == 0 {340- input = []Token{Token{text: &item.text, prefixLength: 0}}340+ input = []Token{{text: &item.text, prefixLength: 0}}341 } else {342 input = p.transformInput(item)343 }344 if p.fuzzy {4 unmodified lines349 350 func (p *Pattern) extendedMatch(item *Item, withPos bool, slab *util.Slab) ([]Offset, int, *[]int) {351 var input []Token352 if len(p.nth) == 0 {353- input = []Token{Token{text: &item.text, prefixLength: 0}}353+ input = []Token{{text: &item.text, prefixLength: 0}}354 } else {355 input = p.transformInput(item)356 }357 offsets := []Offset{}68 unmodified linesmodified:src/result_test.go+6 added-6 removed
16 unmodified lines17 }18 19 func TestOffsetSort(t *testing.T) {20 offsets := []Offset{21- Offset{3, 5}, Offset{2, 7},22- Offset{1, 3}, Offset{2, 9}}21+ {3, 5}, {2, 7},22+ {1, 3}, {2, 9}}23 sort.Sort(ByOrder(offsets))24 25 if offsets[0][0] != 1 || offsets[0][1] != 3 ||26 offsets[1][0] != 2 || offsets[1][1] != 7 ||56 unmodified lines83 }84 85 // Sort by relevance86 item3 := buildResult(87- withIndex(&Item{}, 2), []Offset{Offset{1, 3}, Offset{5, 7}}, 3)87+ withIndex(&Item{}, 2), []Offset{{1, 3}, {5, 7}}, 3)88 item4 := buildResult(89- withIndex(&Item{}, 2), []Offset{Offset{1, 2}, Offset{6, 7}}, 4)89+ withIndex(&Item{}, 2), []Offset{{1, 2}, {6, 7}}, 4)90 item5 := buildResult(91- withIndex(&Item{}, 2), []Offset{Offset{1, 3}, Offset{5, 7}}, 5)91+ withIndex(&Item{}, 2), []Offset{{1, 3}, {5, 7}}, 5)92 item6 := buildResult(93- withIndex(&Item{}, 2), []Offset{Offset{1, 2}, Offset{6, 7}}, 6)93+ withIndex(&Item{}, 2), []Offset{{1, 2}, {6, 7}}, 6)94 items = []Result{item1, item2, item3, item4, item5, item6}95 sort.Sort(ByRelevance(items))96 if !(items[0] == item6 && items[1] == item5 &&97 items[2] == item4 && items[3] == item3 &&62 unmodified linesmodified:Makefile+1 added
64 unmodified lines65 66 all: target/$(BINARY)67 68 test: $(SOURCES)69+ [ -z "$$(gofmt -s -d src)" ] || (gofmt -s -d src; exit 1)70 SHELL=/bin/sh GOOS= $(GO) test -v -tags "$(TAGS)" \71 github.com/junegunn/fzf/src \72 github.com/junegunn/fzf/src/algo \73 github.com/junegunn/fzf/src/tui \83 unmodified lines