github.com/aiven/aiven-go-client@v1.36.0/vpc_peering_connection_test.go (about) 1 package aiven 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestEqStrPointers(t *testing.T) { 11 foo := "foo" 12 bar := "bar" 13 cases := []struct { 14 a, b *string 15 expected bool 16 }{ 17 { 18 a: &foo, 19 b: &foo, 20 expected: true, 21 }, 22 { 23 a: nil, 24 b: nil, 25 expected: true, 26 }, 27 { 28 a: &foo, 29 b: &bar, 30 expected: false, 31 }, 32 { 33 a: &bar, 34 b: &foo, 35 expected: false, 36 }, 37 { 38 a: &foo, 39 b: nil, 40 expected: false, 41 }, 42 { 43 a: nil, 44 b: &foo, 45 expected: false, 46 }, 47 } 48 49 for i, o := range cases { 50 t.Run(fmt.Sprintf("case %d", i), func(t *testing.T) { 51 assert.Equal(t, eqStrPointers(o.a, o.b), o.expected) 52 }) 53 } 54 }