(t *testing.T)
| 76 | } |
| 77 | |
| 78 | func TestTimeNotNull(t *testing.T) { |
| 79 | type s struct { |
| 80 | Time time.Time |
| 81 | } |
| 82 | var b bytes.Buffer |
| 83 | enc := GetEncoder(&b) |
| 84 | defer PutEncoder(enc) |
| 85 | |
| 86 | // Example encoding of a populated time: |
| 87 | if err := enc.Encode(s{Time: time.Unix(0, 0).UTC()}); err != nil { |
| 88 | t.Error(err) |
| 89 | } |
| 90 | t.Log(b.String()) |
| 91 | b.Reset() |
| 92 | |
| 93 | // Now encode a zero time and make sure it's a string. |
| 94 | if err := enc.Encode(s{}); err != nil { |
| 95 | t.Error(err) |
| 96 | } |
| 97 | t.Log(b.String()) |
| 98 | if strings.Contains(b.String(), "null") { |
| 99 | t.Error("wanted non-null encoding") |
| 100 | } |
| 101 | } |
nothing calls this directly
no test coverage detected