-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathzap_test.go
More file actions
21 lines (17 loc) · 1.12 KB
/
zap_test.go
File metadata and controls
21 lines (17 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main
import (
"testing"
"github.com/solodynamo/custom-log-marshaler/fixtures"
"github.com/stretchr/testify/assert"
)
func TestZapGenerate(t *testing.T) {
generate("./fixtures/zapexample.go", &UberZap{})
assert.True(t, fixtures.ContainsText("\t\tif l.Name != nil { enc.AddString(\"name\", *l.Name) }", "./fixtures/zapexample.go"))
assert.True(t, fixtures.ContainsText("\t\tenc.AddObject(\"user\", l.User)", "./fixtures/zapexample.go"))
assert.True(t, fixtures.ContainsText("\t\tenc.AddBool(\"from_cache\", l.FromCache)", "./fixtures/zapexample.go"))
assert.True(t, fixtures.ContainsText("\t\tenc.AddString(\"language\", l.Language)", "./fixtures/zapexample.go"))
assert.True(t, fixtures.ContainsText("\t\tenc.AddString(\"translation\", l.Translation)", "./fixtures/zapexample.go"))
assert.True(t, fixtures.ContainsText("\t\tenc.AddReflected(\"translations\", l.Translations)", "./fixtures/zapexample.go"))
assert.True(t, fixtures.ContainsText("\t\tenc.AddReflected(\"metadata\", l.Metadata)", "./fixtures/zapexample.go"))
assert.True(t, fixtures.ContainsText("\t\tenc.AddReflected(\"no\", l.No)", "./fixtures/zapexample.go"))
}