github.com/aavshr/aws-sdk-go@v1.41.3/service/dynamodb/expression/error_test.go (about) 1 //go:build go1.7 2 // +build go1.7 3 4 package expression 5 6 import ( 7 "testing" 8 ) 9 10 func TestInvalidParameterError(t *testing.T) { 11 cases := []struct { 12 name string 13 input InvalidParameterError 14 expected string 15 }{ 16 { 17 name: "invalid error", 18 input: newInvalidParameterError("func", "param"), 19 expected: "func error: invalid parameter: param", 20 }, 21 } 22 for _, c := range cases { 23 t.Run(c.name, func(t *testing.T) { 24 actual := c.input.Error() 25 if e, a := c.expected, actual; e != a { 26 t.Errorf("expect %v, got %v", e, a) 27 } 28 }) 29 } 30 } 31 32 func TestUnsetParameterError(t *testing.T) { 33 cases := []struct { 34 name string 35 input UnsetParameterError 36 expected string 37 }{ 38 { 39 name: "unset error", 40 input: newUnsetParameterError("func", "param"), 41 expected: "func error: unset parameter: param", 42 }, 43 } 44 for _, c := range cases { 45 t.Run(c.name, func(t *testing.T) { 46 actual := c.input.Error() 47 if e, a := c.expected, actual; e != a { 48 t.Errorf("expect %v, got %v", e, a) 49 } 50 }) 51 } 52 }