1####################################################### 2# 3# test join() 4# 5####################################################### 6 7body common control 8{ 9 inputs => { "../../default.cf.sub" }; 10 bundlesequence => { default("$(this.promise_filename)") }; 11 version => "1.0"; 12} 13 14####################################################### 15 16bundle agent init 17{ 18 vars: 19 "a" slist => { "b", "c", "a" }; 20 "b" slist => { "100", "9", "10" }; 21 "c" slist => { }; 22 "d" slist => { "", "a", "", "b" }; 23 "e" slist => { "a", "1", "b" }; 24 "f" rlist => { "100", "200", "300" }; 25 "g" rlist => { "1.11", "-2.22", "-3.33" }; 26 "h" ilist => { "-10", "0", "200" }; 27 "i" data => parsejson('[ 1, 2, "", 3000, "" ]'); 28 "j" data => parsejson('[ 1, 2, [ 3, 4, 5 ], null, true, false ]'); 29 "k" data => parsejson('{}'); 30 "l" data => parsejson('{ "a": 100, "b": 200, "c": null}'); 31 "m" slist => { "cf_null" }; 32 "n" slist => { "a", "b", "c", "cf_null" }; 33 "o" slist => { @(a), @(c) }; 34 "p" slist => { @(c), @(m) }; 35 "q" slist => { ":", ":" }; 36 "r" slist => { ":", @(c) }; 37 "s" slist => { ":", @(c), @(m) }; 38 "t" slist => { @(n), @(m), @(n), ":" }; 39 40 "lists" slist => { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t" }; 41} 42 43####################################################### 44 45bundle agent test 46{ 47 # "expected_a" string => "b:c:a"; 48 # "expected_b" string => "100:9:10"; 49 # "expected_c" string => ""; 50 # "expected_d" string => ":a::b"; 51 # "expected_e" string => "a:1:b"; 52 # "expected_f" string => "100:200:300"; 53 # "expected_g" string => "1.11:-2.22:-3.33"; 54 # "expected_h" string => "-10:0:200"; 55 # "expected_i" string => "1:2::3000:"; 56 # "expected_j" string => "1:2:true:false"; 57 # "expected_k" string => ""; 58 # "expected_l" string => "100:200"; 59 # "expected_m" string => "cf_null"; 60 # "expected_n" string => "a:b:c:cf_null"; 61 # "expected_o" string => "b:c:a"; 62 # "expected_p" string => "cf_null"; 63 # "expected_q" string => ":::"; 64 # "expected_r" string => ":"; 65 # "expected_s" string => "::cf_null"; 66 # "expected_t" string => "a:b:c:cf_null:cf_null:a:b:c:cf_null::"; 67 vars: 68 "lists" slist => { @(init.lists) }; 69 "join_$(lists)" string => join(":", "init.$(lists)"); 70} 71 72 73####################################################### 74 75bundle agent check 76{ 77 methods: 78 "check" usebundle => dcs_check_state(test, 79 "$(this.promise_filename).expected.json", 80 $(this.promise_filename)); 81} 82