forked from boyter/cs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start to add in fuzzy filename support
- Loading branch information
Showing
28 changed files
with
41,758 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package main | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestPreParseQuery(t *testing.T) { | ||
type args struct { | ||
args []string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want []string | ||
want1 string | ||
}{ | ||
{ | ||
name: "empty", | ||
args: args{ | ||
args: []string{}, | ||
}, | ||
want: []string{}, | ||
want1: "", | ||
}, | ||
{ | ||
name: "no fuzzy", | ||
args: args{ | ||
args: []string{"test"}, | ||
}, | ||
want: []string{"test"}, | ||
want1: "", | ||
}, | ||
{ | ||
name: "single fuzzy", | ||
args: args{ | ||
args: []string{"file:test"}, | ||
}, | ||
want: []string{}, | ||
want1: "test", | ||
}, | ||
{ | ||
name: "single fuzzy alternate", | ||
args: args{ | ||
args: []string{"filename:test"}, | ||
}, | ||
want: []string{}, | ||
want1: "test", | ||
}, | ||
{ | ||
name: "multi fuzzy last wins", | ||
args: args{ | ||
args: []string{"file:test", "file:other"}, | ||
}, | ||
want: []string{}, | ||
want1: "other", | ||
}, | ||
{ | ||
name: "single fuzzy single term", | ||
args: args{ | ||
args: []string{"stuff", "file:test"}, | ||
}, | ||
want: []string{"stuff"}, | ||
want1: "test", | ||
}, | ||
{ | ||
name: "single fuzzy uppercase", | ||
args: args{ | ||
args: []string{"FILE:test", "UPPER"}, | ||
}, | ||
want: []string{"UPPER"}, | ||
want1: "test", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, got1 := PreParseQuery(tt.args.args) | ||
if !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("PreParseQuery() got = %v, want %v", got, tt.want) | ||
} | ||
if got1 != tt.want1 { | ||
t.Errorf("PreParseQuery() got1 = %v, want %v", got1, tt.want1) | ||
} | ||
}) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.