DHowett / go-plist

A pure Go Apple Property List transcoder
Other
410 stars 96 forks source link

marshal byte array failed #61

Closed mwpcheung closed 3 years ago

mwpcheung commented 3 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 3 years ago

Good find, thanks!

DHowett commented 3 years ago

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