github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/pkg/kubernetes/resources/adaptertesting/expect.go (about)

     1  package adaptertesting
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/golang/mock/gomock"
     7  )
     8  
     9  func ExpectValue(testCase string, value interface{}) gomock.Matcher {
    10  
    11  	return gomock.GotFormatterAdapter(
    12  		gomock.GotFormatterFunc(func(i interface{}) string {
    13  			return fmt.Sprintf("\x1b[1;31m\"%s\"\x1b[0m\n%+v", testCase, i)
    14  		}),
    15  		gomock.WantFormatter(
    16  			gomock.StringerFunc(func() string { return fmt.Sprintf("\n%+v", value) }),
    17  			gomock.Eq(value),
    18  		),
    19  	)
    20  }