this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

mst: use x/maps.Clone in tests

authored by

Brad Fitzpatrick and committed by
bnewbold
0430d074 5f7e4afd

+7 -14
+1 -1
go.mod
··· 38 38 go.opentelemetry.io/otel v1.14.0 39 39 go.opentelemetry.io/otel/exporters/jaeger v1.14.0 40 40 go.opentelemetry.io/otel/sdk v1.14.0 41 + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 41 42 golang.org/x/sync v0.1.0 42 43 golang.org/x/tools v0.8.0 43 44 golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 ··· 117 118 go.uber.org/multierr v1.11.0 // indirect 118 119 go.uber.org/zap v1.24.0 // indirect 119 120 golang.org/x/crypto v0.7.0 // indirect 120 - golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect 121 121 golang.org/x/mod v0.10.0 // indirect 122 122 golang.org/x/net v0.9.0 // indirect 123 123 golang.org/x/sys v0.7.0 // indirect
+6 -13
mst/mst_test.go
··· 18 18 "github.com/ipld/go-car/v2" 19 19 "github.com/multiformats/go-multihash" 20 20 mh "github.com/multiformats/go-multihash" 21 + "golang.org/x/exp/maps" 21 22 ) 22 23 23 24 func randCid() cid.Cid { ··· 177 178 return hex.EncodeToString(buf) 178 179 } 179 180 180 - func copyMap(a map[string]string) map[string]string { 181 - out := make(map[string]string) 182 - for k, v := range a { 183 - out[k] = v 184 - } 185 - return out 186 - } 187 - 188 181 func TestDiffInsertionsBasic(t *testing.T) { 189 182 a := map[string]string{ 190 183 "cats/asdf": randStr(1), 191 184 "cats/foosesdf": randStr(2), 192 185 } 193 186 194 - b := copyMap(a) 187 + b := maps.Clone(a) 195 188 b["cats/bawda"] = randStr(3) 196 189 b["cats/crosasd"] = randStr(4) 197 190 ··· 216 209 a[randKey(i)] = randStr(72385739 - i) 217 210 } 218 211 219 - b := copyMap(a) 212 + b := maps.Clone(a) 220 213 for i := int64(0); i < 30; i++ { 221 214 b[randKey(5000+i)] = randStr(2293825 - i) 222 215 } ··· 246 239 a[randKey(i)] = randStr(72385739 - i) 247 240 } 248 241 249 - b := copyMap(a) 242 + b := maps.Clone(a) 250 243 251 244 for i := int64(0); i < 1000; i++ { 252 245 a[randKey(i)] = randStr(682823 - i) ··· 266 259 a[randKey(i)] = randStr(72385739 - i) 267 260 } 268 261 269 - b := copyMap(a) 262 + b := maps.Clone(a) 270 263 271 264 for i := int64(0); i < 20; i++ { 272 265 a[randKey(i)] = randStr(682823 - i) ··· 286 279 "cats/foosesdf": randStr(2), 287 280 } 288 281 289 - b := copyMap(a) 282 + b := maps.Clone(a) 290 283 b["cats/asdf"] = randStr(3) 291 284 292 285 testMapDiffs(t, a, b)