Skip to content

Commit

Permalink
test: fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: francois  samin <[email protected]>
  • Loading branch information
fsamin committed May 2, 2022
1 parent 22e13db commit cec0b96
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,20 +429,25 @@ func TestWithDetailedStruct(t *testing.T) {
type T struct {
A int
B string
T *T
}

a := T{23, "foo bar"}
a := T{23, "foo bar", &T{A: 46, B: "fiz buzz"}}

enc := dump.NewDefaultEncoder()
enc.ExtraFields.DetailedStruct = true
enc.ExtraFields.Type = false
enc.ExtraFields.Len = true
res, _ := enc.Sdump(a)
t.Log(res)
assert.Equal(t, `T: {"A":23,"B":"foo bar"}
T.A: 23
assert.Equal(t, `T.A: 23
T.B: foo bar
T.__Len__: 2
T.T: {"A":46,"B":"fiz buzz","T":null}
T.T.A: 46
T.T.B: fiz buzz
T.T.T:
T.T.__Len__: 3
T.__Len__: 3
`, res)
}

Expand Down

0 comments on commit cec0b96

Please sign in to comment.