Skip to content

Commit

Permalink
add appendarray test
Browse files Browse the repository at this point in the history
  • Loading branch information
khushijain21 committed May 31, 2024
1 parent 9dae4bc commit a1b0d6e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions bridges/otelzap/encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,19 @@ func TestArrayEncoder(t *testing.T) {
f func(zapcore.ArrayEncoder)
expected interface{}
}{
// AppendObject and AppendArray are covered by the AddObject (nested) and
// AddArray (nested) cases above.
// AppendObject is covered by AddObject (nested) case above.
{
desc: "AppendArray (arrays of arrays)",
f: func(e zapcore.ArrayEncoder) {
err := e.AppendArray(zapcore.ArrayMarshalerFunc(func(inner zapcore.ArrayEncoder) error {
inner.AppendBool(true)
inner.AppendBool(false)
return nil
}))
assert.NoError(t, err)
},
expected: []interface{}{true, false},
},
{"AppendBool", func(e zapcore.ArrayEncoder) { e.AppendBool(true) }, true},
{"AppendByteString", func(e zapcore.ArrayEncoder) { e.AppendByteString([]byte("foo")) }, "foo"},
{"AppendFloat64", func(e zapcore.ArrayEncoder) { e.AppendFloat64(3.14) }, 3.14},
Expand Down

0 comments on commit a1b0d6e

Please sign in to comment.