1####################################################### 2# 3# Test regextract 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 parsed:: 26 "part1_as_int" int => "$(part[1])"; 27 "part2_as_int" int => "$(part[2])"; 28 29 "part1_as_str" string => "$(part[1])"; 30 "part2_as_str" string => "$(part[2])"; 31 32 classes: 33 "parsed" expression => regextract("^node-(\d+)-0*(\d+)", "node-8-01", "part"); 34} 35 36 37####################################################### 38 39bundle agent check 40{ 41 classes: 42 "ok1" expression => strcmp("$(test.part1_as_int)", "$(test.part1_as_str)"); 43 "ok2" expression => strcmp("$(test.part2_as_int)", "$(test.part2_as_str)"); 44 45 "ok" and => { "ok1", "ok2" }; 46 47 reports: 48 ok:: 49 "$(this.promise_filename) Pass"; 50 !ok:: 51 "$(this.promise_filename) FAIL"; 52} 53