1// Copyright (C) MongoDB, Inc. 2017-present. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); you may 4// not use this file except in compliance with the License. You may obtain 5// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 6 7package mongo 8 9import ( 10 "os" 11 "reflect" 12 "testing" 13 14 "github.com/google/go-cmp/cmp" 15 "go.mongodb.org/mongo-driver/bson/bsoncodec" 16 "go.mongodb.org/mongo-driver/internal/testutil/assert" 17 "go.mongodb.org/mongo-driver/mongo/readconcern" 18 "go.mongodb.org/mongo-driver/mongo/readpref" 19 "go.mongodb.org/mongo-driver/mongo/writeconcern" 20 "go.mongodb.org/mongo-driver/x/bsonx" 21) 22 23func TestMain(m *testing.M) { 24 // register equality options 25 assert.RegisterOpts(reflect.TypeOf(&Client{}), cmp.Comparer(func(c1, c2 *Client) bool { 26 return c1 == c2 27 })) 28 assert.RegisterOpts(reflect.TypeOf(&bsoncodec.Registry{}), cmp.Comparer(func(r1, r2 *bsoncodec.Registry) bool { 29 return r1 == r2 30 })) 31 32 assert.RegisterOpts(reflect.TypeOf(&readconcern.ReadConcern{}), cmp.AllowUnexported(readconcern.ReadConcern{})) 33 assert.RegisterOpts(reflect.TypeOf(&writeconcern.WriteConcern{}), cmp.AllowUnexported(writeconcern.WriteConcern{})) 34 assert.RegisterOpts(reflect.TypeOf(&readpref.ReadPref{}), cmp.AllowUnexported(readpref.ReadPref{})) 35 assert.RegisterOpts(reflect.TypeOf(bsonx.Doc{}), cmp.AllowUnexported(bsonx.Elem{}, bsonx.Val{})) 36 assert.RegisterOpts(reflect.TypeOf(bsonx.Arr{}), cmp.AllowUnexported(bsonx.Val{})) 37 38 os.Exit(m.Run()) 39} 40