From d0afee5defa7c342a97e4f444f715eb70f0779a3 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Mon, 10 Jul 2017 08:28:31 +0100 Subject: [PATCH] few tests with YAML --- sandpit/test_yaml.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sandpit/test_yaml.go b/sandpit/test_yaml.go index ebe8758..bd90e01 100644 --- a/sandpit/test_yaml.go +++ b/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) }