github.com/qxnw/lib4go@v0.0.0-20180426074627-c80c7e84b925/influxdb/models/points_internal_test.go (about) 1 package models 2 3 import "testing" 4 5 func TestMarshalPointNoFields(t *testing.T) { 6 points, err := ParsePointsString("m,k=v f=0i") 7 if err != nil { 8 t.Fatal(err) 9 } 10 11 // It's unclear how this can ever happen, but we've observed points that were marshalled without any fields. 12 points[0].(*point).fields = []byte{} 13 14 if _, err := points[0].MarshalBinary(); err != ErrPointMustHaveAField { 15 t.Fatalf("got error %v, exp %v", err, ErrPointMustHaveAField) 16 } 17 }