Skip to content

Commit

Permalink
Added failing tests of stretchr#979
Browse files Browse the repository at this point in the history
  • Loading branch information
leoleoasd committed Jul 27, 2020
1 parent ed4976c commit 1c8633f
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions assert/assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,46 @@ func TestObjectsAreEqual(t *testing.T) {

}

func TestObjectsAreEqual_SerializedTime(t *testing.T) {
t0 := time.Now().Round(0)
b, err := json.Marshal(t0)
if err != nil {
t.Fail()
}
var t1 time.Time
if err := json.Unmarshal(b, &t1); err != nil {
t.Fail()
}
if !ObjectsAreEqual(t0, t1) {
t.Errorf("time must be equals")
}
}

func TestObjectsAreEqual_StructContainingTime(t *testing.T) {
// struct containing struct containing time
a := struct {
Inner struct {
time.Time
}
}{
struct{ time.Time }{
time.Now(),
},
}
b := struct {
Inner struct {
time.Time
}
}{
struct{ time.Time }{
a.Inner.UTC(),
},
}
if !ObjectsAreEqual(a, b) {
t.Error("struct containing same time time should be equal.")
}
}

func TestImplements(t *testing.T) {

mockT := new(testing.T)
Expand Down

0 comments on commit 1c8633f

Please sign in to comment.