DHowett / go-plist

A pure Go Apple Property List transcoder
Other
416 stars 97 forks source link

marshal byte array failed #61

Closed mwpcheung closed 4 years ago

mwpcheung commented 4 years ago
import (
    "log"
    "testing"

    dhplist "howett.net/plist"
)

type ObjectInfo struct {
    ID [12]byte
}

func TestMarshal(t *testing.T) {
    var Object ObjectInfo
    body, err := dhplist.MarshalIndent(&Object, dhplist.XMLFormat, "")
    if err != nil {
        log.Printf("error %+v", err)
        t.Error("error marshal")
    } else {
        log.Printf("body %s", body)
    }
}

test result error reflect: call of reflect.Value.Bytes on array Value --- FAIL: TestMarshal (0.00s) app_test.go:19: error marshal

DHowett commented 4 years ago

Good find, thanks!

DHowett commented 4 years ago

Enjoy! I added some test coverage for this as well. :smile: