Skip to content

Commit

Permalink
fixed #131
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Apr 7, 2022
1 parent b4dbd93 commit 588c4a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func AssertZero(t testRunner, value interface{}, msg ...interface{}) {
}

if !internal.IsZero(value) {
internal.Fail(t, "An object that !!should have it's zero value!!, does not have it's zero value.", internal.NewObjectsSingleNamed("object", value), msg...)
internal.Fail(t, "An object that !!should have its zero value!!, does not have its zero value.", internal.NewObjectsSingleUnknown(value), msg...)
}
}

Expand All @@ -163,7 +163,7 @@ func AssertNotZero(t testRunner, value interface{}, msg ...interface{}) {
}

if internal.IsZero(value) {
internal.Fail(t, "An object that !!should not have it's zero value!!, does have it's zero value.", internal.NewObjectsSingleNamed("object", value), msg...)
internal.Fail(t, "An object that !!should not have its zero value!!, does have its zero value.", internal.NewObjectsSingleUnknown(value), msg...)
}
}

Expand Down
7 changes: 4 additions & 3 deletions internal/fail-printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,18 @@ func NewObjectsSingleUnknown(obj interface{}) Objects {
return Objects{
{
Name: "Object",
NameStyle: pterm.NewStyle(pterm.FgMagenta),
Data: obj,
DataStyle: pterm.NewStyle(pterm.FgYellow),
},
}
}

func NewObjectsSingleNamed(name string, obj interface{}) Objects {
return Objects{
{
Name: name,
Data: obj,
Name: name,
NameStyle: pterm.NewStyle(pterm.FgMagenta),
Data: obj,
},
}
}
Expand Down

0 comments on commit 588c4a9

Please sign in to comment.