aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/smartystreets/assertions/serializer.go
diff options
context:
space:
mode:
authorunknwon <u@gogs.io>2019-07-28 16:03:54 -0700
committerunknwon <u@gogs.io>2019-07-28 16:03:54 -0700
commit025972ef643fa7628551529c2fd145e2a184465b (patch)
tree1066a33af394fc4fb7bdbcaa2b2fe29875576877 /vendor/github.com/smartystreets/assertions/serializer.go
parent00a3e368b482193f1a457586ab4152ffacc02fab (diff)
vendor: update missing test deps for ci
Diffstat (limited to 'vendor/github.com/smartystreets/assertions/serializer.go')
-rw-r--r--vendor/github.com/smartystreets/assertions/serializer.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/vendor/github.com/smartystreets/assertions/serializer.go b/vendor/github.com/smartystreets/assertions/serializer.go
index 90ae3e3b..f1e3570e 100644
--- a/vendor/github.com/smartystreets/assertions/serializer.go
+++ b/vendor/github.com/smartystreets/assertions/serializer.go
@@ -3,6 +3,7 @@ package assertions
import (
"encoding/json"
"fmt"
+ "strings"
"github.com/smartystreets/assertions/internal/go-render/render"
)
@@ -15,28 +16,28 @@ type Serializer interface {
type failureSerializer struct{}
func (self *failureSerializer) serializeDetailed(expected, actual interface{}, message string) string {
+ if index := strings.Index(message, " Diff:"); index > 0 {
+ message = message[:index]
+ }
view := FailureView{
Message: message,
Expected: render.Render(expected),
Actual: render.Render(actual),
}
- serialized, err := json.Marshal(view)
- if err != nil {
- return message
- }
+ serialized, _ := json.Marshal(view)
return string(serialized)
}
func (self *failureSerializer) serialize(expected, actual interface{}, message string) string {
+ if index := strings.Index(message, " Diff:"); index > 0 {
+ message = message[:index]
+ }
view := FailureView{
Message: message,
Expected: fmt.Sprintf("%+v", expected),
Actual: fmt.Sprintf("%+v", actual),
}
- serialized, err := json.Marshal(view)
- if err != nil {
- return message
- }
+ serialized, _ := json.Marshal(view)
return string(serialized)
}
@@ -57,8 +58,8 @@ type FailureView struct {
///////////////////////////////////////////////////////
// noopSerializer just gives back the original message. This is useful when we are using
-// the assertions from a context other than the web UI, that requires the JSON structure
-// provided by the failureSerializer.
+// the assertions from a context other than the GoConvey Web UI, that requires the JSON
+// structure provided by the failureSerializer.
type noopSerializer struct{}
func (self *noopSerializer) serialize(expected, actual interface{}, message string) string {