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 7 package bsonrw 8 9 import "testing" 10 11 func compareErrors(err1, err2 error) bool { 12 if err1 == nil && err2 == nil { 13 return true 14 } 15 16 if err1 == nil || err2 == nil { 17 return false 18 } 19 20 if err1.Error() != err2.Error() { 21 return false 22 } 23 24 return true 25 } 26 27 func noerr(t *testing.T, err error) { 28 if err != nil { 29 t.Helper() 30 t.Errorf("Unexpected error: (%T)%v", err, err) 31 t.FailNow() 32 } 33 } 34