few tests with YAML

pull/1/head
KatolaZ 8 years ago
parent c63c8c8778
commit d0afee5def
  1. 20
      sandpit/test_yaml.go

@ -34,12 +34,23 @@ s_msg:
- s_tag: BUILD
s_args:
- suites/jessie
- suites/ascii
- suites/ascii
- s_tag: REMOVE
s_args:
- file1
- s_tag: CUSTOM
s_args: [first, second, third]
`
var other_msg = `
s_msg: [
{s_tag: "BUILD", s_args: [suites/jessie, suites/ascii]},
{s_tag: "REMOVE", s_args: [file1]},
{s_tag: "CUSTOM", s_args: [first, second, third]}
]
`
var cfg_str = `
s_cfg:
- s_tag: BUILD
@ -53,6 +64,11 @@ s_cfg:
- s_tag: REMOVE
s_commands:
- s_cmd: file:///bin/rm
- s_tag: CUSTOM
s_commands: [
{s_cmd: "file:///home/user/script/sh", s_hash: "1234567890abcdef"},
{s_cmd: "http://my.server.net/submit.php", s_hash: "0987654321abce"}
]
`
func main() {
@ -63,7 +79,7 @@ func main() {
//log.Printf("%s\n", test_str)
err := yaml.Unmarshal([]byte(msg_str), &c)
err := yaml.Unmarshal([]byte(other_msg), &c)
if err != nil {
log.Fatal("error: ", err)
}

Loading…
Cancel
Save