github.com/segmentio/encoding@v0.4.0/thrift/decode_test.go (about) 1 package thrift_test 2 3 import ( 4 "bytes" 5 "io" 6 "testing" 7 8 "github.com/segmentio/encoding/thrift" 9 ) 10 11 func TestDecodeEOF(t *testing.T) { 12 p := thrift.CompactProtocol{} 13 d := thrift.NewDecoder(p.NewReader(bytes.NewReader(nil))) 14 v := struct{ Name string }{} 15 16 if err := d.Decode(&v); err != io.EOF { 17 t.Errorf("unexpected error returned: %v", err) 18 } 19 }