| 1 | // Copyright 2024 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package modindex_testscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/ |
| 6 | |
| 7 | import ( |
| 8 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 9 | "logscip-go gomod github.com/golang/go/src go1.25.0 log/" |
| 10 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 11 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 12 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 13 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 14 | |
| 15 | . "golang.org/x/tools/internal/modindexscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/" |
| 16 | ) |
| 17 | |
| 18 | type tdatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata# struct { |
| 19 | fnamescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#fname. string |
| 20 | pkgscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#pkg. string |
| 21 | itemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#items. []titemscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem# |
| 22 | } |
| 23 | |
| 24 | type titemscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem# struct { |
| 25 | codescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem#code. string |
| 26 | resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem#result. resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result# |
| 27 | } |
| 28 | |
| 29 | var thedatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/thedata. = tdatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#{ |
| 30 | fnamescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#fname.: "cloud.google.com/go/[email protected]/foo.go", |
| 31 | pkgscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#pkg.: "foo", |
| 32 | itemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#items.: []titemscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem#{ |
| 33 | // these need to be in alphabetical order |
| 34 | {"func Foo() {}", resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#{"Foo", Funcscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Func., false, 0, nil}}, |
| 35 | {"const FooC = 23", resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#{"FooC", Constscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Const., false, 0, nil}}, |
| 36 | {"func FooF(int, float) error {return nil}", resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#{"FooF", Funcscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Func., false, 1, |
| 37 | []Fieldscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Field#{{"_", "int"}, {"_", "float"}}}}, |
| 38 | {"type FooT struct{}", resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#{"FooT", Typescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Type., false, 0, nil}}, |
| 39 | {"var FooV int", resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#{"FooV", Varscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Var., false, 0, nil}}, |
| 40 | {"func Goo() {}", resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#{"Goo", Funcscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Func., false, 0, nil}}, |
| 41 | {"/*Deprecated: too weird\n*/\n// Another Goo\nvar GooVV int", resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#{"GooVV", Varscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Var., true, 0, nil}}, |
| 42 | {"func Ⱋoox(x int) {}", resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#{"Ⱋoox", Funcscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Func., false, 0, []Fieldscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Field#{{"x", "int"}}}}, |
| 43 | }, |
| 44 | } |
| 45 | |
| 46 | type resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result# struct { |
| 47 | namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#name. string |
| 48 | typscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#typ. LexTypescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/LexType# |
| 49 | deprecatedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#deprecated. bool |
| 50 | resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#result. int |
| 51 | sigscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#sig. []Fieldscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Field# |
| 52 | } |
| 53 | |
| 54 | func okresultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/okresult().(r resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#, p Candidatescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#) bool { |
| 55 | if r.namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#name. != p.Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#Name. || r.typscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#typ. != p.Typescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#Type. || r.resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#result. != int(p.Resultsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#Results.) { |
| 56 | return false |
| 57 | } |
| 58 | if r.deprecatedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#deprecated. != p.Deprecatedscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#Deprecated. { |
| 59 | return false |
| 60 | } |
| 61 | if len(r.sigscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#sig.) != len(p.Sigscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#Sig.) { |
| 62 | return false |
| 63 | } |
| 64 | for i := 0; i < len(r.sigscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#sig.); i++ { |
| 65 | if r.sigscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/result#sig.[i] != p.Sigscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#Sig.[i] { |
| 66 | return false |
| 67 | } |
| 68 | } |
| 69 | return true |
| 70 | } |
| 71 | |
| 72 | func TestLookupscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/TestLookup().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 73 | dir := testModCachescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/testModCache().(t) |
| 74 | wrtDatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/wrtData().(t, dir, thedatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/thedata.) |
| 75 | if _, err := Createscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Create().(dir); err != nil { |
| 76 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 77 | } |
| 78 | ix, err := Readscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Read().(dir) |
| 79 | if err != nil { |
| 80 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 81 | } |
| 82 | if len(ix.Entriesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#Entries.) != 1 { |
| 83 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("got %d Entries, expected 1", len(ix.Entriesscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#Entries.)) |
| 84 | } |
| 85 | // get all the symbols |
| 86 | p := ix.Lookupscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#Lookup().("foo", "", true) |
| 87 | if len(p) > 0 && !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(p[0].ImportPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#ImportPath., "Longrunning") { |
| 88 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("Failed to convert escaped path: %s", p[0].ImportPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#ImportPath.) |
| 89 | } |
| 90 | if len(p) != len(thedatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/thedata..itemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#items.) { |
| 91 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d possibilities for pkg foo, expected %d", len(p), len(thedatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/thedata..itemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#items.)) |
| 92 | } |
| 93 | for i, r := range thedatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/thedata..itemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#items. { |
| 94 | if !okresultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/okresult().(r.resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem#result., p[i]) { |
| 95 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %#v, expected %#v", p[i], r.resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem#result.) |
| 96 | } |
| 97 | } |
| 98 | // look for the Foo... and check that each is a Foo... |
| 99 | p = ix.Lookupscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#Lookup().("foo", "Foo", true) |
| 100 | if len(p) != 5 { |
| 101 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d possibilities for foo.Foo*, expected 5", len(p)) |
| 102 | } |
| 103 | for _, r := range p { |
| 104 | if !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(r.Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#Name., "Foo") { |
| 105 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %s, expected Foo...", r.Namescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Candidate#Name.) |
| 106 | } |
| 107 | } |
| 108 | // fail to find something |
| 109 | p = ix.Lookupscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#Lookup().("foo", "FooVal", false) |
| 110 | if len(p) != 0 { |
| 111 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d possibilities for foo.FooVal, expected 0", len(p)) |
| 112 | } |
| 113 | // find an exact match |
| 114 | p = ix.Lookupscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#Lookup().("foo", "Foo", false) |
| 115 | if len(p) != 1 { |
| 116 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d possibilities for foo.Foo, expected 1", len(p)) |
| 117 | } |
| 118 | // "Foo" is the first test datum |
| 119 | if !okresultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/okresult().(thedatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/thedata..itemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#items.[0].resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem#result., p[0]) { |
| 120 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %#v, expected %#v", p[0], thedatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/thedata..itemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#items.[0].resultscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem#result.) |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | func wrtDatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/wrtData().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, dir string, data tdatascip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#) { |
| 125 | t.Helperscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Helper().() |
| 126 | locname := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/FromSlash().(data.fnamescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#fname.) |
| 127 | if err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.MkdirAllscip-go gomod github.com/golang/go/src go1.25.0 os/MkdirAll().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dir, filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(locname)), 0755); err != nil { |
| 128 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 129 | } |
| 130 | fd, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Createscip-go gomod github.com/golang/go/src go1.25.0 os/Create().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dir, locname)) |
| 131 | if err != nil { |
| 132 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 133 | } |
| 134 | defer fd.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 135 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintf().(fd, "package %s\n", data.pkgscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#pkg.) |
| 136 | for _, item := range data.itemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/tdata#items. { |
| 137 | fd.WriteStringscip-go gomod github.com/golang/go/src go1.25.0 os/File#WriteString().(item.codescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/titem#code. + "\n") |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func TestLookupAllscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/TestLookupAll().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 142 | logscip-go gomod github.com/golang/go/src go1.25.0 log/.SetFlagsscip-go gomod github.com/golang/go/src go1.25.0 log/SetFlags().(logscip-go gomod github.com/golang/go/src go1.25.0 log/.Lshortfilescip-go gomod github.com/golang/go/src go1.25.0 log/Lshortfile.) |
| 143 | dir := testModCachescip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/testModCache().(t) |
| 144 | wrtModule := func(mod string, nms ...string) { |
| 145 | dname := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dir, mod) |
| 146 | if err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.MkdirAllscip-go gomod github.com/golang/go/src go1.25.0 os/MkdirAll().(dname, 0755); err != nil { |
| 147 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 148 | } |
| 149 | fname := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(dname, "foo.go") |
| 150 | fd, err := osscip-go gomod github.com/golang/go/src go1.25.0 os/.Createscip-go gomod github.com/golang/go/src go1.25.0 os/Create().(fname) |
| 151 | if err != nil { |
| 152 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 153 | } |
| 154 | defer fd.Closescip-go gomod github.com/golang/go/src go1.25.0 os/File#Close().() |
| 155 | if _, err := fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintf().(fd, "package foo\n"); err != nil { |
| 156 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 157 | } |
| 158 | for _, nm := range nms { |
| 159 | fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Fprintf().(fd, "func %s() {}\n", nm) |
| 160 | } |
| 161 | } |
| 162 | wrtModule("a.com/go/[email protected]", "A", "B", "C", "D") |
| 163 | wrtModule("b.com/go/[email protected]", "A", "B", "C") |
| 164 | wrtModule("c.com/go/[email protected]", "A", "B", "C", "D", "E") |
| 165 | |
| 166 | if _, err := Createscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Create().(dir); err != nil { |
| 167 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 168 | } |
| 169 | ix, err := Readscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Read().(dir) |
| 170 | if err != nil { |
| 171 | t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err) |
| 172 | } |
| 173 | cands := ix.Lookupscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#Lookup().("foo", "A", false) |
| 174 | if len(cands) != 3 { |
| 175 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d candidates for A, expected 3", len(cands)) |
| 176 | } |
| 177 | got := ix.LookupAllscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#LookupAll().("foo", "A", "B", "C", "D") |
| 178 | if len(got) != 2 { |
| 179 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d candidates for A,B,C,D, expected 2", len(got)) |
| 180 | } |
| 181 | got = ix.LookupAllscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Index#LookupAll().("foo", []string{"A", "B", "C", "D", "E"}...) |
| 182 | if len(got) != 1 { |
| 183 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d candidates for A,B,C,D,E, expected 1", len(got)) |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | func TestUniquifyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex_test`/TestUniquify().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 188 | var v []string |
| 189 | for i := 1; i < 4; i++ { |
| 190 | v = append(v, "A") |
| 191 | w := Uniquifyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Uniquify.(v) |
| 192 | if len(w) != 1 { |
| 193 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d, expected 1", len(w)) |
| 194 | } |
| 195 | } |
| 196 | for i := 1; i < 3; i++ { |
| 197 | v = append(v, "B", "C") |
| 198 | w := Uniquifyscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/modindex`/Uniquify.(v) |
| 199 | if len(w) != 3 { |
| 200 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("got %d, expected 3", len(w)) |
| 201 | } |
| 202 | } |
| 203 | } |