github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/compiler_error_test.go (about) 1 package swagguard_test 2 3 import ( 4 "fmt" 5 "strings" 6 "testing" 7 8 "github.com/aeternity/aepp-sdk-go/swagguard/compiler/client/operations" 9 "github.com/aeternity/aepp-sdk-go/swagguard/compiler/models" 10 ) 11 12 func TestCompilerErrorModelDereferencing(t *testing.T) { 13 reason := "A Very Good Reason" 14 compileContractBadRequest := operations.NewCompileContractBadRequest() 15 err := models.Error{Reason: &reason} 16 compileContractBadRequest.Payload = &err 17 printedError := fmt.Sprintf("BadRequest %s", compileContractBadRequest) 18 if !strings.Contains(printedError, reason) { 19 t.Errorf("Expected to find %s when printing out the models.Error: got %s instead", reason, printedError) 20 } 21 }