-
Notifications
You must be signed in to change notification settings - Fork 13
/
example_Unmarshal_test.go
28 lines (23 loc) · 1.53 KB
/
example_Unmarshal_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package watson_test
import (
"fmt"
"github.com/genkami/watson"
)
type Music struct {
Track int `watson:"track"`
Title string `watson:"title"`
}
const marshaledMusic = `
~?
SShaarrkShaaaarrkShaaaaarrkShaaaaaarrk-SSharrkShaaaarrkShaaaaarrkShaaaaaarrk-SShkShaaaaarrkShaaaaaarrk-SShkSharrkShaaaaarrkShaaaaaarrk-SShkSharrkShaaarrkShaaaaarrkShaaaaaarrk-SShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkShaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrkzg$
BBubbaBubbbbaBubbbbbaBubbbbbba!BBuaBubbbaBubbbbbaBubbbbbba!BBubbaBubbbbaBubbbbbaBubbbbbba!BBubbaBubbbaBubbbbbaBubbbbbba!BBuaBubbaBubbbbbaBubbbbbba!?
SShaaarrkShaaaaaarrk-SShkShaaarrkShaaaaaarrk-SSharrkShaarrkShaaarrkShaaaaaarrk-SShkSharrkShaarrkShaaarrkShaaaaaarrk-SShaarrkShaaaarrkShaaaaaarrk-SShkSharrkShaarrkShaaarrkShaaaaaarrk-SSharrkShaaaarrkShaaaaaarrk-SShkShaaarrkShaaaaaarrk-g
`
func ExampleUnmarshal() {
var music Music
err := watson.Unmarshal([]byte(marshaledMusic), &music)
if err != nil {
panic(err)
}
fmt.Printf("Track: %d, Title: %s\n", music.Track, music.Title)
}