...
1
2
3
4 package object
5
6 import (
7 "errors"
8 "testing"
9
10 "github.com/stretchr/testify/assert"
11 )
12
13 func TestInvalidAnnotationErrorString(t *testing.T) {
14 testCases := map[string]struct {
15 err InvalidAnnotationError
16 expectedString string
17 }{
18 "cluster-scoped": {
19 err: InvalidAnnotationError{
20 Annotation: "example",
21 Cause: errors.New("underlying error"),
22 },
23 expectedString: `invalid "example" annotation: underlying error`,
24 },
25 }
26
27 for tn, tc := range testCases {
28 t.Run(tn, func(t *testing.T) {
29 assert.Equal(t, tc.expectedString, tc.err.Error())
30 })
31 }
32 }
33
View as plain text