func TestSimpleReaderUUID(t *testing.T) { b := new(bytes.Buffer) writer := NewSimpleWriter(b) u := uuid.NewUUID() writer.Serialize(u) writer.Serialize(u) writer.Serialize(u.String()) writer.Serialize([]byte(u)) writer.Serialize(nil) writer.Serialize(nil) reader := NewSimpleReader(b) var x uuid.UUID var p *uuid.UUID var err error if err = reader.Unserialize(&x); err != nil { t.Error(err.Error()) } if x.String() != u.String() { t.Error(x) } if err = reader.Unserialize(&p); err != nil { t.Error(err.Error()) } if (*p).String() != u.String() { t.Error(*p) } if err = reader.Unserialize(&x); err != nil { t.Error(err.Error()) } if x.String() != u.String() { t.Error(x) } if err = reader.Unserialize(&p); err != nil { t.Error(err.Error()) } if (*p).String() != u.String() { t.Error(*p) } if err = reader.Unserialize(&x); err != nil { t.Error(err.Error()) } if x.String() != "" { t.Error(x) } if err = reader.Unserialize(&p); err != nil { t.Error(err.Error()) } if p != nil { t.Error(*p) } }
func New(email, uri string) *Job { u, _ := url.Parse(uri) key := uuid.NewUUID() return &Job{email, u, key, nil, "", DefaultAuthor, ""} }