| 1368 | } |
| 1369 | |
| 1370 | func TestGithubIssue11(t *testing.T) { |
| 1371 | // https://github.com/segmentio/encoding/issues/11 |
| 1372 | v := struct{ F float64 }{ |
| 1373 | F: math.NaN(), |
| 1374 | } |
| 1375 | |
| 1376 | _, err := Marshal(v) |
| 1377 | if err == nil { |
| 1378 | t.Error("no error returned when marshalling NaN value") |
| 1379 | } else if s := err.Error(); !strings.Contains(s, "NaN") { |
| 1380 | t.Error("error returned when marshalling NaN value does not mention 'NaN':", s) |
| 1381 | } else { |
| 1382 | t.Log(s) |
| 1383 | } |
| 1384 | } |
| 1385 | |
| 1386 | type Issue13 struct { |
| 1387 | Stringer fmt.Stringer |