1####################################################### 2# 3# Test mapdata() 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} 19 20####################################################### 21 22bundle agent test 23{ 24 vars: 25 "load1" data => parsejson('[ 1, 2, 3]'); 26 "load2" slist => { "eleme\"nt1", "element2", "element3" }; 27 "load3" data => parsejson('{ "x\\"x": "y\\"y" }'); 28 "load4" data => parsejson('[]'); 29 "load5[mykey]" slist => { "myvalue" }; 30 "load5[anotherkey]" string => "anothervalue"; 31 "load5[lastkey!]" slist => { "o\"ne", "two", "three" }; 32 "load6" data => parsejson('{ "a": { "b": "c" } }'); 33 34 "static[x]" string => "xvalue"; 35 "static[x\"x]" string => "xxvalue"; 36 "static[0]" string => "0value"; 37 "static[1]" string => "1value"; 38 "static[2]" string => "2value"; 39 "static[lastkey!]" string => "lastvalue"; 40 "static[anotherkey]" string => "anothervalue"; 41 "static[mykey]" string => "myvalue"; 42 "static[a]" string => "avalue"; 43 44 "spec1" string => "key = $(this.k)"; 45 "spec2" string => "key = $(this.k), value = ${this.v}"; 46 "spec3" string => "key = $(this.k), key2 = $(this.k[1]), value = ${this.v}"; 47 "spec4" string => "xvalue should be $(static[$(this.k)])"; 48 49 "jsonspec1" string => '{ "key": "$(this.k)", "value": "$(this.v)"'; 50 "jsonspec2" string => '{ "key": "$(this.k)", "value": "$(this.v)" }'; 51 "jsonspec3" string => '[ "$(this.k)", "$(this.v)" ]'; 52 "jsonspec4" string => '{ "key": "$(this.k)", "key2": "$(this.k[1])", "value": "$(this.v)" }'; 53 54 "X" slist => { "1", "2", "3", "4", "5", "6" }; 55 "Y" slist => { "1", "2", "3", "4" }; 56 57 "mapdata_none_$(X)_$(Y)" data => mapdata("none", "$(spec$(Y))", "load$(X)"); 58 "mapdata_none_str_$(X)_$(Y)" string => format("%S", "mapdata_none_$(X)_$(Y)"); 59 60 "mapdata_canonify_$(X)_$(Y)" data => mapdata("canonify", "$(spec$(Y))", "load$(X)"); 61 "mapdata_canonify_str_$(X)_$(Y)" string => format("%S", "mapdata_canonify_$(X)_$(Y)"); 62 63 "mapdata_canonify_eval_$(X)_$(Y)" data => mapdata("canonify", concat("$(spec$(Y))"), "load$(X)"); 64 "mapdata_canonify_eval_str_$(X)_$(Y)" string => format("%S", "mapdata_canonify_eval_$(X)_$(Y)"); 65 66 "mapdata_json_$(X)_$(Y)" data => mapdata("json", "$(jsonspec$(Y))", "load$(X)"); 67 "mapdata_json_str_$(X)_$(Y)" string => format("%S", "mapdata_json_$(X)_$(Y)"); 68 69 "bad1" data => mapdata("json", "", missingvar); 70 71 "justastring" string => "me"; 72 "bad3" data => mapdata("json", "", justastring); 73 74 classes: 75 'mapdata_none_1_1_ok' and => { regcmp('.*"key = 0".*', '$(mapdata_none_str_1_1)'), 76 regcmp('.*"key = 1".*', '$(mapdata_none_str_1_1)'), 77 regcmp('.*"key = 2".*', '$(mapdata_none_str_1_1)') }; 78 'mapdata_none_1_2_ok' and => { regcmp('.*"key = 0, value = 1".*', '$(mapdata_none_str_1_2)'), 79 regcmp('.*"key = 1, value = 2".*', '$(mapdata_none_str_1_2)'), 80 regcmp('.*"key = 2, value = 3".*', '$(mapdata_none_str_1_2)') }; 81 'mapdata_none_1_3_ok' and => { regcmp('.*"key = 0, key2 = \$\(this.k\[1\]\), value = 1".*', '$(mapdata_none_str_1_3)'), 82 regcmp('.*"key = 1, key2 = \$\(this.k\[1\]\), value = 2".*', '$(mapdata_none_str_1_3)'), 83 regcmp('.*"key = 2, key2 = \$\(this.k\[1\]\), value = 3".*', '$(mapdata_none_str_1_3)') }; 84 'mapdata_none_1_4_ok' and => { regcmp('.*"xvalue should be 0value".*', '$(mapdata_none_str_1_4)'), 85 regcmp('.*"xvalue should be 1value".*', '$(mapdata_none_str_1_4)'), 86 regcmp('.*"xvalue should be 2value".*', '$(mapdata_none_str_1_4)') }; 87 'mapdata_none_2_1_ok' and => { regcmp('.*"key = 0".*', '$(mapdata_none_str_2_1)'), 88 regcmp('.*"key = 1".*', '$(mapdata_none_str_2_1)'), 89 regcmp('.*"key = 2".*', '$(mapdata_none_str_2_1)') }; 90 'mapdata_none_2_2_ok' and => { regcmp('.*"key = 0, value = eleme\\\\"nt1".*', '$(mapdata_none_str_2_2)'), 91 regcmp('.*"key = 1, value = element2".*', '$(mapdata_none_str_2_2)'), 92 regcmp('.*"key = 2, value = element3".*', '$(mapdata_none_str_2_2)') }; 93 'mapdata_none_2_3_ok' and => { regcmp('.*"key = 0, key2 = \$\(this.k\[1\]\), value = eleme\\\\"nt1".*', '$(mapdata_none_str_2_3)'), 94 regcmp('.*"key = 1, key2 = \$\(this.k\[1\]\), value = element2".*', '$(mapdata_none_str_2_3)'), 95 regcmp('.*"key = 2, key2 = \$\(this.k\[1\]\), value = element3".*', '$(mapdata_none_str_2_3)') }; 96 'mapdata_none_2_4_ok' and => { regcmp('.*"xvalue should be 0value".*', '$(mapdata_none_str_2_4)'), 97 regcmp('.*"xvalue should be 1value".*', '$(mapdata_none_str_2_4)'), 98 regcmp('.*"xvalue should be 2value".*', '$(mapdata_none_str_2_4)') }; 99 'mapdata_none_3_1_ok' and => { regcmp('.*"key = x\\\\"x".*', '$(mapdata_none_str_3_1)') }; 100 'mapdata_none_3_2_ok' and => { regcmp('.*"key = x\\\\"x, value = y\\\\"y".*', '$(mapdata_none_str_3_2)') }; 101 'mapdata_none_3_3_ok' and => { regcmp('.*"key = x\\\\"x, key2 = \$\(this.k\[1\]\), value = y\\\\"y".*', '$(mapdata_none_str_3_3)') }; 102 'mapdata_none_3_4_ok' and => { regcmp('.*"xvalue should be xxvalue".*', '$(mapdata_none_str_3_4)') }; 103 'mapdata_none_4_1_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); 104 'mapdata_none_4_2_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); 105 'mapdata_none_4_3_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); 106 'mapdata_none_4_4_ok' expression => strcmp('$(mapdata_none_str_4_1)', '[]'); 107 'mapdata_none_5_1_ok' and => { regcmp('.*"key = mykey".*', '$(mapdata_none_str_5_1)'), 108 regcmp('.*"key = anotherkey".*', '$(mapdata_none_str_5_1)'), 109 regcmp('.*"key = lastkey!".*', '$(mapdata_none_str_5_1)') }; 110 'mapdata_none_5_2_ok' and => { regcmp('.*"key = mykey, value = myvalue".*', '$(mapdata_none_str_5_2)'), 111 regcmp('.*"key = anotherkey, value = anothervalue".*', '$(mapdata_none_str_5_2)'), 112 regcmp('.*"key = lastkey!, value = o\\\\"ne".*', '$(mapdata_none_str_5_2)'), 113 regcmp('.*"key = lastkey!, value = two".*', '$(mapdata_none_str_5_2)'), 114 regcmp('.*"key = lastkey!, value = three".*', '$(mapdata_none_str_5_2)') }; 115 'mapdata_none_5_3_ok' and => { regcmp('.*"key = mykey, key2 = \$\(this.k\[1\]\), value = myvalue".*', '$(mapdata_none_str_5_3)'), 116 regcmp('.*"key = anotherkey, key2 = \$\(this.k\[1\]\), value = anothervalue".*', '$(mapdata_none_str_5_3)'), 117 regcmp('.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = o\\\\"ne".*', '$(mapdata_none_str_5_3)'), 118 regcmp('.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = two".*', '$(mapdata_none_str_5_3)'), 119 regcmp('.*"key = lastkey!, key2 = \$\(this.k\[1\]\), value = three".*', '$(mapdata_none_str_5_3)') }; 120 'mapdata_none_5_4_ok' and => { regcmp('.*"xvalue should be myvalue".*', '$(mapdata_none_str_5_4)'), 121 regcmp('.*"xvalue should be anothervalue".*', '$(mapdata_none_str_5_4)'), 122 regcmp('.*"xvalue should be lastvalue".*', '$(mapdata_none_str_5_4)') }; 123 'mapdata_none_6_1_ok' and => { regcmp('.*"key = a".*', '$(mapdata_none_str_6_1)') }; 124 'mapdata_none_6_2_ok' and => { regcmp('.*"key = a, value = c".*', '$(mapdata_none_str_6_2)') }; 125 'mapdata_none_6_3_ok' and => { regcmp('.*"key = a, key2 = b, value = c".*', '$(mapdata_none_str_6_3)') }; 126 'mapdata_none_6_4_ok' and => { regcmp('.*"xvalue should be avalue".*', '$(mapdata_none_str_6_4)') }; 127 128 'mapdata_canonify_1_1_ok' and => { regcmp('.*"key___0".*', '$(mapdata_canonify_str_1_1)'), 129 regcmp('.*"key___1".*', '$(mapdata_canonify_str_1_1)'), 130 regcmp('.*"key___2".*', '$(mapdata_canonify_str_1_1)') }; 131 'mapdata_canonify_1_2_ok' and => { regcmp('.*"key___0__value___1".*', '$(mapdata_canonify_str_1_2)'), 132 regcmp('.*"key___1__value___2".*', '$(mapdata_canonify_str_1_2)'), 133 regcmp('.*"key___2__value___3".*', '$(mapdata_canonify_str_1_2)') }; 134 'mapdata_canonify_1_3_ok' and => { regcmp('.*"key___0__key2_____this_k_1____value___1".*', '$(mapdata_canonify_str_1_3)'), 135 regcmp('.*"key___1__key2_____this_k_1____value___2".*', '$(mapdata_canonify_str_1_3)'), 136 regcmp('.*"key___2__key2_____this_k_1____value___3".*', '$(mapdata_canonify_str_1_3)') }; 137 'mapdata_canonify_1_4_ok' and => { regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_str_1_4)'), 138 regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_str_1_4)'), 139 regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_str_1_4)') }; 140 'mapdata_canonify_2_1_ok' and => { regcmp('.*"key___0".*', '$(mapdata_canonify_str_2_1)'), 141 regcmp('.*"key___1".*', '$(mapdata_canonify_str_2_1)'), 142 regcmp('.*"key___2".*', '$(mapdata_canonify_str_2_1)') }; 143 'mapdata_canonify_2_2_ok' and => { regcmp('.*"key___0__value___eleme_nt1".*', '$(mapdata_canonify_str_2_2)'), 144 regcmp('.*"key___1__value___element2".*', '$(mapdata_canonify_str_2_2)'), 145 regcmp('.*"key___2__value___element3".*', '$(mapdata_canonify_str_2_2)') }; 146 'mapdata_canonify_2_3_ok' and => { regcmp('.*"key___0__key2_____this_k_1____value___eleme_nt1".*', '$(mapdata_canonify_str_2_3)'), 147 regcmp('.*"key___1__key2_____this_k_1____value___element2".*', '$(mapdata_canonify_str_2_3)'), 148 regcmp('.*"key___2__key2_____this_k_1____value___element3".*', '$(mapdata_canonify_str_2_3)') }; 149 'mapdata_canonify_2_4_ok' and => { regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_str_2_4)'), 150 regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_str_2_4)'), 151 regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_str_2_4)') }; 152 'mapdata_canonify_3_1_ok' and => { regcmp('.*"key___x_x".*', '$(mapdata_canonify_str_3_1)') }; 153 'mapdata_canonify_3_2_ok' and => { regcmp('.*"key___x_x__value___y_y".*', '$(mapdata_canonify_str_3_2)') }; 154 'mapdata_canonify_3_3_ok' and => { regcmp('.*"key___x_x__key2_____this_k_1____value___y_y".*', '$(mapdata_canonify_str_3_3)') }; 155 'mapdata_canonify_3_4_ok' and => { regcmp('.*"xvalue_should_be_xxvalue".*', '$(mapdata_canonify_str_3_4)') }; 156 'mapdata_canonify_4_1_ok' expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); 157 'mapdata_canonify_4_2_ok' expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); 158 'mapdata_canonify_4_3_ok' expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); 159 'mapdata_canonify_4_4_ok' expression => strcmp('$(mapdata_canonify_str_4_1)', '[]'); 160 'mapdata_canonify_5_1_ok' and => { regcmp('.*"key___mykey".*', '$(mapdata_canonify_str_5_1)'), 161 regcmp('.*"key___anotherkey".*', '$(mapdata_canonify_str_5_1)'), 162 regcmp('.*"key___lastkey_".*', '$(mapdata_canonify_str_5_1)') }; 163 'mapdata_canonify_5_2_ok' and => { regcmp('.*"key___mykey__value___myvalue".*', '$(mapdata_canonify_str_5_2)'), 164 regcmp('.*"key___anotherkey__value___anothervalue".*', '$(mapdata_canonify_str_5_2)'), 165 regcmp('.*"key___lastkey___value___o_ne".*', '$(mapdata_canonify_str_5_2)'), 166 regcmp('.*"key___lastkey___value___two".*', '$(mapdata_canonify_str_5_2)'), 167 regcmp('.*"key___lastkey___value___three".*', '$(mapdata_canonify_str_5_2)') }; 168 'mapdata_canonify_5_3_ok' and => { regcmp('.*"key___mykey__key2_____this_k_1____value___myvalue".*', '$(mapdata_canonify_str_5_3)'), 169 regcmp('.*"key___anotherkey__key2_____this_k_1____value___anothervalue".*', '$(mapdata_canonify_str_5_3)'), 170 regcmp('.*"key___lastkey___key2_____this_k_1____value___o_ne".*', '$(mapdata_canonify_str_5_3)'), 171 regcmp('.*"key___lastkey___key2_____this_k_1____value___two".*', '$(mapdata_canonify_str_5_3)'), 172 regcmp('.*"key___lastkey___key2_____this_k_1____value___three".*', '$(mapdata_canonify_str_5_3)') }; 173 'mapdata_canonify_5_4_ok' and => { regcmp('.*"xvalue_should_be_myvalue".*', '$(mapdata_canonify_str_5_4)'), 174 regcmp('.*"xvalue_should_be_anothervalue".*', '$(mapdata_canonify_str_5_4)'), 175 regcmp('.*"xvalue_should_be_lastvalue".*', '$(mapdata_canonify_str_5_4)') }; 176 'mapdata_canonify_6_1_ok' and => { regcmp('.*"key___a".*', '$(mapdata_canonify_str_6_1)') }; 177 'mapdata_canonify_6_2_ok' and => { regcmp('.*"key___a__value___c".*', '$(mapdata_canonify_str_6_2)') }; 178 'mapdata_canonify_6_3_ok' and => { regcmp('.*"key___a__key2___b__value___c".*', '$(mapdata_canonify_str_6_3)') }; 179 'mapdata_canonify_6_4_ok' and => { regcmp('.*"xvalue_should_be_avalue".*', '$(mapdata_canonify_str_6_4)') }; 180 181 'mapdata_canonify_eval_1_1_ok' and => { regcmp('.*"key___0".*', '$(mapdata_canonify_eval_str_1_1)'), 182 regcmp('.*"key___1".*', '$(mapdata_canonify_eval_str_1_1)'), 183 regcmp('.*"key___2".*', '$(mapdata_canonify_eval_str_1_1)') }; 184 'mapdata_canonify_eval_1_2_ok' and => { regcmp('.*"key___0__value___1".*', '$(mapdata_canonify_eval_str_1_2)'), 185 regcmp('.*"key___1__value___2".*', '$(mapdata_canonify_eval_str_1_2)'), 186 regcmp('.*"key___2__value___3".*', '$(mapdata_canonify_eval_str_1_2)') }; 187 'mapdata_canonify_eval_1_3_ok' and => { regcmp('.*"key___0__key2_____this_k_1____value___1".*', '$(mapdata_canonify_eval_str_1_3)'), 188 regcmp('.*"key___1__key2_____this_k_1____value___2".*', '$(mapdata_canonify_eval_str_1_3)'), 189 regcmp('.*"key___2__key2_____this_k_1____value___3".*', '$(mapdata_canonify_eval_str_1_3)') }; 190 'mapdata_canonify_eval_1_4_ok' and => { regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_eval_str_1_4)'), 191 regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_eval_str_1_4)'), 192 regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_eval_str_1_4)') }; 193 'mapdata_canonify_eval_2_1_ok' and => { regcmp('.*"key___0".*', '$(mapdata_canonify_eval_str_2_1)'), 194 regcmp('.*"key___1".*', '$(mapdata_canonify_eval_str_2_1)'), 195 regcmp('.*"key___2".*', '$(mapdata_canonify_eval_str_2_1)') }; 196 'mapdata_canonify_eval_2_2_ok' and => { regcmp('.*"key___0__value___eleme_nt1".*', '$(mapdata_canonify_eval_str_2_2)'), 197 regcmp('.*"key___1__value___element2".*', '$(mapdata_canonify_eval_str_2_2)'), 198 regcmp('.*"key___2__value___element3".*', '$(mapdata_canonify_eval_str_2_2)') }; 199 'mapdata_canonify_eval_2_3_ok' and => { regcmp('.*"key___0__key2_____this_k_1____value___eleme_nt1".*', '$(mapdata_canonify_eval_str_2_3)'), 200 regcmp('.*"key___1__key2_____this_k_1____value___element2".*', '$(mapdata_canonify_eval_str_2_3)'), 201 regcmp('.*"key___2__key2_____this_k_1____value___element3".*', '$(mapdata_canonify_eval_str_2_3)') }; 202 'mapdata_canonify_eval_2_4_ok' and => { regcmp('.*"xvalue_should_be_0value".*', '$(mapdata_canonify_eval_str_2_4)'), 203 regcmp('.*"xvalue_should_be_1value".*', '$(mapdata_canonify_eval_str_2_4)'), 204 regcmp('.*"xvalue_should_be_2value".*', '$(mapdata_canonify_eval_str_2_4)') }; 205 'mapdata_canonify_eval_3_1_ok' and => { regcmp('.*"key___x_x".*', '$(mapdata_canonify_eval_str_3_1)') }; 206 'mapdata_canonify_eval_3_2_ok' and => { regcmp('.*"key___x_x__value___y_y".*', '$(mapdata_canonify_eval_str_3_2)') }; 207 'mapdata_canonify_eval_3_3_ok' and => { regcmp('.*"key___x_x__key2_____this_k_1____value___y_y".*', '$(mapdata_canonify_eval_str_3_3)') }; 208 'mapdata_canonify_eval_3_4_ok' and => { regcmp('.*"xvalue_should_be_xxvalue".*', '$(mapdata_canonify_eval_str_3_4)') }; 209 'mapdata_canonify_eval_4_1_ok' expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); 210 'mapdata_canonify_eval_4_2_ok' expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); 211 'mapdata_canonify_eval_4_3_ok' expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); 212 'mapdata_canonify_eval_4_4_ok' expression => strcmp('$(mapdata_canonify_eval_str_4_1)', '[]'); 213 'mapdata_canonify_eval_5_1_ok' and => { regcmp('.*"key___mykey".*', '$(mapdata_canonify_eval_str_5_1)'), 214 regcmp('.*"key___anotherkey".*', '$(mapdata_canonify_eval_str_5_1)'), 215 regcmp('.*"key___lastkey_".*', '$(mapdata_canonify_eval_str_5_1)') }; 216 'mapdata_canonify_eval_5_2_ok' and => { regcmp('.*"key___mykey__value___myvalue".*', '$(mapdata_canonify_eval_str_5_2)'), 217 regcmp('.*"key___anotherkey__value___anothervalue".*', '$(mapdata_canonify_eval_str_5_2)'), 218 regcmp('.*"key___lastkey___value___o_ne".*', '$(mapdata_canonify_eval_str_5_2)'), 219 regcmp('.*"key___lastkey___value___two".*', '$(mapdata_canonify_eval_str_5_2)'), 220 regcmp('.*"key___lastkey___value___three".*', '$(mapdata_canonify_eval_str_5_2)') }; 221 'mapdata_canonify_eval_5_3_ok' and => { regcmp('.*"key___mykey__key2_____this_k_1____value___myvalue".*', '$(mapdata_canonify_eval_str_5_3)'), 222 regcmp('.*"key___anotherkey__key2_____this_k_1____value___anothervalue".*', 223 '$(mapdata_canonify_eval_str_5_3)'), 224 regcmp('.*"key___lastkey___key2_____this_k_1____value___o_ne".*', '$(mapdata_canonify_eval_str_5_3)'), 225 regcmp('.*"key___lastkey___key2_____this_k_1____value___two".*', '$(mapdata_canonify_eval_str_5_3)'), 226 regcmp('.*"key___lastkey___key2_____this_k_1____value___three".*', '$(mapdata_canonify_eval_str_5_3)') }; 227 'mapdata_canonify_eval_5_4_ok' and => { regcmp('.*"xvalue_should_be_myvalue".*', '$(mapdata_canonify_eval_str_5_4)'), 228 regcmp('.*"xvalue_should_be_anothervalue".*', '$(mapdata_canonify_eval_str_5_4)'), 229 regcmp('.*"xvalue_should_be_lastvalue".*', '$(mapdata_canonify_eval_str_5_4)') }; 230 'mapdata_canonify_eval_6_1_ok' and => { regcmp('.*"key___a".*', '$(mapdata_canonify_eval_str_6_1)') }; 231 'mapdata_canonify_eval_6_2_ok' and => { regcmp('.*"key___a__value___c".*', '$(mapdata_canonify_eval_str_6_2)') }; 232 'mapdata_canonify_eval_6_3_ok' and => { regcmp('.*"key___a__key2___b__value___c".*', '$(mapdata_canonify_eval_str_6_3)') }; 233 'mapdata_canonify_eval_6_4_ok' and => { regcmp('.*"xvalue_should_be_avalue".*', '$(mapdata_canonify_eval_str_6_4)') }; 234 235 'mapdata_json_1_1_ok' expression => strcmp('$(mapdata_json_str_1_1)', '[]'); 236 'mapdata_json_1_2_ok' and => { regcmp('.*\{"key":"0","value":"1"\}.*', '$(mapdata_json_str_1_2)'), 237 regcmp('.*\{"key":"1","value":"2"\}.*', '$(mapdata_json_str_1_2)'), 238 regcmp('.*\{"key":"2","value":"3"\}.*', '$(mapdata_json_str_1_2)') }; 239 'mapdata_json_1_3_ok' and => { regcmp('.*\["0","1"\].*', '$(mapdata_json_str_1_3)'), 240 regcmp('.*\["1","2"\].*', '$(mapdata_json_str_1_3)'), 241 regcmp('.*\["2","3"\].*', '$(mapdata_json_str_1_3)') }; 242 'mapdata_json_1_4_ok' and => { regcmp('.*\{"key":"0","key2":"\$\(this.k\[1\]\)","value":"1"\}.*', '$(mapdata_json_str_1_4)'), 243 regcmp('.*\{"key":"1","key2":"\$\(this.k\[1\]\)","value":"2"\}.*', '$(mapdata_json_str_1_4)'), 244 regcmp('.*\{"key":"2","key2":"\$\(this.k\[1\]\)","value":"3"\}.*', '$(mapdata_json_str_1_4)') }; 245 'mapdata_json_2_1_ok' expression => strcmp('$(mapdata_json_str_2_1)', '[]'); 246 'mapdata_json_2_2_ok' and => { regcmp('.*\{"key":"0","value":"eleme\\\\"nt1"\}.*', '$(mapdata_json_str_2_2)'), 247 regcmp('.*\{"key":"1","value":"element2"\}.*', '$(mapdata_json_str_2_2)'), 248 regcmp('.*\{"key":"2","value":"element3"\}.*', '$(mapdata_json_str_2_2)') }; 249 'mapdata_json_2_3_ok' and => { regcmp('.*\["0","eleme\\\\"nt1"\].*', '$(mapdata_json_str_2_3)'), 250 regcmp('.*\["1","element2"\].*', '$(mapdata_json_str_2_3)'), 251 regcmp('.*\["2","element3"\].*', '$(mapdata_json_str_2_3)') }; 252 'mapdata_json_2_4_ok' and => { regcmp('.*\{"key":"0","key2":"\$\(this.k\[1\]\)","value":"eleme\\\\"nt1"\}.*', '$(mapdata_json_str_2_4)'), 253 regcmp('.*\{"key":"1","key2":"\$\(this.k\[1\]\)","value":"element2"\}.*', '$(mapdata_json_str_2_4)'), 254 regcmp('.*\{"key":"2","key2":"\$\(this.k\[1\]\)","value":"element3"\}.*', '$(mapdata_json_str_2_4)') }; 255 'mapdata_json_3_1_ok' expression => strcmp('$(mapdata_json_str_3_1)', '[]'); 256 'mapdata_json_3_2_ok' and => { regcmp('.*\{"key":"x\\\\"x","value":"y\\\\"y"\}.*', '$(mapdata_json_str_3_2)') }; 257 'mapdata_json_3_3_ok' and => { regcmp('.*\["x\\\\"x","y\\\\"y"\].*', '$(mapdata_json_str_3_3)') }; 258 'mapdata_json_3_4_ok' and => { regcmp('.*\{"key":"x\\\\"x","key2":"\$\(this.k\[1\]\)","value":"y\\\\"y"\}.*', '$(mapdata_json_str_3_4)') }; 259 'mapdata_json_4_1_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); 260 'mapdata_json_4_2_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); 261 'mapdata_json_4_3_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); 262 'mapdata_json_4_4_ok' expression => strcmp('$(mapdata_json_str_4_1)', '[]'); 263 'mapdata_json_5_1_ok' expression => strcmp('$(mapdata_json_str_5_1)', '[]'); 264 'mapdata_json_5_2_ok' and => { regcmp('.*\{"key":"mykey","value":"myvalue"\}.*', '$(mapdata_json_str_5_2)'), 265 regcmp('.*\{"key":"anotherkey","value":"anothervalue"\}.*', '$(mapdata_json_str_5_2)'), 266 regcmp('.*\{"key":"lastkey!","value":"o\\\\"ne"\}.*', '$(mapdata_json_str_5_2)'), 267 regcmp('.*\{"key":"lastkey!","value":"two"\}.*', '$(mapdata_json_str_5_2)'), 268 regcmp('.*\{"key":"lastkey!","value":"three"\}.*', '$(mapdata_json_str_5_2)') }; 269 'mapdata_json_5_3_ok' and => { regcmp('.*\["mykey","myvalue"\].*', '$(mapdata_json_str_5_3)'), 270 regcmp('.*\["anotherkey","anothervalue"\].*', '$(mapdata_json_str_5_3)'), 271 regcmp('.*\["lastkey!","o\\\\"ne"\].*', '$(mapdata_json_str_5_3)'), 272 regcmp('.*\["lastkey!","two"\].*', '$(mapdata_json_str_5_3)'), 273 regcmp('.*\["lastkey!","three"\].*', '$(mapdata_json_str_5_3)') }; 274 'mapdata_json_5_4_ok' and => { regcmp('.*\{"key":"mykey","key2":"\$\(this.k\[1\]\)","value":"myvalue"\}.*', '$(mapdata_json_str_5_4)'), 275 regcmp('.*\{"key":"anotherkey","key2":"\$\(this.k\[1\]\)","value":"anothervalue"\}.*', '$(mapdata_json_str_5_4)'), 276 regcmp('.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"o\\\\"ne"\}.*', '$(mapdata_json_str_5_4)'), 277 regcmp('.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"two"\}.*', '$(mapdata_json_str_5_4)'), 278 regcmp('.*\{"key":"lastkey!","key2":"\$\(this.k\[1\]\)","value":"three"\}.*', '$(mapdata_json_str_5_4)') }; 279 'mapdata_json_6_1_ok' expression => strcmp('$(mapdata_json_str_6_1)', '[]'); 280 'mapdata_json_6_2_ok' and => { regcmp('.*\{"key":"a","value":"c"\}.*', '$(mapdata_json_str_6_2)') }; 281 'mapdata_json_6_3_ok' and => { regcmp('.*\["a","c"\].*', '$(mapdata_json_str_6_3)') }; 282 'mapdata_json_6_4_ok' and => { regcmp('.*\{"key":"a","key2":"b","value":"c"\}.*', '$(mapdata_json_str_6_4)') }; 283 284 "mapdata_none_ok" and => { "mapdata_none_1_1_ok", "mapdata_none_1_2_ok", "mapdata_none_1_3_ok", "mapdata_none_1_4_ok", 285 "mapdata_none_2_1_ok", "mapdata_none_2_2_ok", "mapdata_none_2_3_ok", "mapdata_none_2_4_ok", 286 "mapdata_none_3_1_ok", "mapdata_none_3_2_ok", "mapdata_none_3_3_ok", "mapdata_none_3_4_ok", 287 "mapdata_none_4_1_ok", "mapdata_none_4_2_ok", "mapdata_none_4_3_ok", "mapdata_none_4_4_ok", 288 "mapdata_none_5_1_ok", "mapdata_none_5_2_ok", "mapdata_none_5_3_ok", "mapdata_none_5_4_ok", 289 "mapdata_none_6_1_ok", "mapdata_none_6_2_ok", "mapdata_none_6_3_ok", "mapdata_none_6_4_ok" }; 290 291 "mapdata_canonify_ok" and => { "mapdata_canonify_1_1_ok", "mapdata_canonify_1_2_ok", "mapdata_canonify_1_3_ok", 292 "mapdata_canonify_1_4_ok", "mapdata_canonify_2_1_ok", "mapdata_canonify_2_2_ok", 293 "mapdata_canonify_2_3_ok", "mapdata_canonify_2_4_ok", "mapdata_canonify_3_1_ok", 294 "mapdata_canonify_3_2_ok", "mapdata_canonify_3_3_ok", "mapdata_canonify_3_4_ok", 295 "mapdata_canonify_4_1_ok", "mapdata_canonify_4_2_ok", "mapdata_canonify_4_3_ok", 296 "mapdata_canonify_4_4_ok", "mapdata_canonify_5_1_ok", "mapdata_canonify_5_2_ok", 297 "mapdata_canonify_5_3_ok", "mapdata_canonify_5_4_ok", "mapdata_canonify_6_1_ok", 298 "mapdata_canonify_6_2_ok", "mapdata_canonify_6_3_ok", "mapdata_canonify_6_4_ok" }; 299 300 "mapdata_canonify_eval_ok" and => { "mapdata_canonify_eval_1_1_ok", "mapdata_canonify_eval_1_2_ok", "mapdata_canonify_eval_1_3_ok", 301 "mapdata_canonify_eval_1_4_ok", "mapdata_canonify_eval_2_1_ok", "mapdata_canonify_eval_2_2_ok", 302 "mapdata_canonify_eval_2_3_ok", "mapdata_canonify_eval_2_4_ok", "mapdata_canonify_eval_3_1_ok", 303 "mapdata_canonify_eval_3_2_ok", "mapdata_canonify_eval_3_3_ok", "mapdata_canonify_eval_3_4_ok", 304 "mapdata_canonify_eval_4_1_ok", "mapdata_canonify_eval_4_2_ok", "mapdata_canonify_eval_4_3_ok", 305 "mapdata_canonify_eval_4_4_ok", "mapdata_canonify_eval_5_1_ok", "mapdata_canonify_eval_5_2_ok", 306 "mapdata_canonify_eval_5_3_ok", "mapdata_canonify_eval_5_4_ok", "mapdata_canonify_eval_6_1_ok", 307 "mapdata_canonify_eval_6_2_ok", "mapdata_canonify_eval_6_3_ok", "mapdata_canonify_eval_6_4_ok" }; 308 309 "mapdata_json_ok" and => { "mapdata_json_1_1_ok", "mapdata_json_1_2_ok", "mapdata_json_1_3_ok", "mapdata_json_1_4_ok", 310 "mapdata_json_2_1_ok", "mapdata_json_2_2_ok", "mapdata_json_2_3_ok", "mapdata_json_2_4_ok", 311 "mapdata_json_3_1_ok", "mapdata_json_3_2_ok", "mapdata_json_3_3_ok", "mapdata_json_3_4_ok", 312 "mapdata_json_4_1_ok", "mapdata_json_4_2_ok", "mapdata_json_4_3_ok", "mapdata_json_4_4_ok", 313 "mapdata_json_5_1_ok", "mapdata_json_5_2_ok", "mapdata_json_5_3_ok", "mapdata_json_5_4_ok", 314 "mapdata_json_6_1_ok", "mapdata_json_6_2_ok", "mapdata_json_6_3_ok", "mapdata_json_6_4_ok" }; 315 316 317 "ok" and => { "mapdata_none_ok", "mapdata_canonify_ok", "mapdata_canonify_eval_ok", "mapdata_json_ok" }, 318 scope => "namespace"; 319} 320 321####################################################### 322 323bundle agent check 324{ 325 reports: 326 DEBUG:: 327 "mapdata_none*:"; 328 "mapdata_none_str_$(test.X)_$(test.Y): '$(test.mapdata_none_str_$(test.X)_$(test.Y))'"; 329 330 ok:: 331 "$(this.promise_filename) Pass"; 332 333 !ok:: 334 "$(this.promise_filename) FAIL"; 335} 336