now marshaller respects options like 'omitempty'

This commit is contained in:
Vincent Batts 2014-08-14 21:05:31 -04:00
parent 058076e94f
commit e27d7cfab2
3 changed files with 71 additions and 3 deletions

View file

@ -1,6 +1,7 @@
package torrent
import (
"bytes"
"github.com/vbatts/go-bt/bencode"
"testing"
)
@ -19,6 +20,10 @@ func TestFileMarshal(t *testing.T) {
t.Fatal(err)
}
if bytes.Contains(buf, []byte("omitempty")) || bytes.Contains(buf, []byte("created by")) {
t.Errorf("should not have the string 'omitempty' or 'created by' in %q", buf)
}
f2 := File{}
err = bencode.Unmarshal(buf, &f2)
if err != nil {