File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,6 +155,29 @@ func (e employees) Values() iter.Seq[string] {
155155 }
156156}
157157
158+ func TestFindNoSort (t * testing.T ) {
159+ // The higher-scoring match ("my name is_Ramsey", 36) comes second in the
160+ // input, so preserving input order proves results are returned unsorted.
161+ want := fuzzy.Matches {
162+ {
163+ Str : "moduleNameResolver.ts" ,
164+ Index : 0 ,
165+ MatchedIndexes : []int {0 , 6 , 10 },
166+ Score : 32 ,
167+ },
168+ {
169+ Str : "my name is_Ramsey" ,
170+ Index : 1 ,
171+ MatchedIndexes : []int {0 , 3 , 11 },
172+ Score : 36 ,
173+ },
174+ }
175+ got := fuzzy .FindNoSort ("mnr" , []string {"moduleNameResolver.ts" , "my name is_Ramsey" })
176+ if diff := pretty .Compare (want , got ); diff != "" {
177+ t .Errorf ("%v" , diff )
178+ }
179+ }
180+
158181func TestFindFromSource (t * testing.T ) {
159182 emps := employees {
160183 {
You can’t perform that action at this time.
0 commit comments