1####################################################### 2# 3# Test readstringlist() issue 364 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 files: 19 "$(G.testfile)" 20 delete => init_delete; 21 22 "$(G.testfile)" 23 create => "true", 24 edit_line => init_fill_in; 25} 26 27bundle edit_line init_fill_in 28{ 29 insert_lines: 30 "123"; 31 "456"; 32} 33 34body delete init_delete 35{ 36 dirlinks => "delete"; 37 rmdirs => "true"; 38} 39 40####################################################### 41 42bundle agent test 43{ 44 vars: 45 "nums" slist => readstringlist("$(G.testfile)","NoComment","\s+",5,100); 46 "sum" real => sum("nums"); 47} 48 49####################################################### 50 51bundle agent check 52{ 53 vars: 54 "nums" slist => { @{test.nums} }; 55 56 classes: 57 "ok_list" not => strcmp("won't match", "$(nums)"); 58 "ok123" expression => strcmp("123", "$(nums)"); 59 "ok456" expression => strcmp("456", "$(nums)"); 60 "ok" and => { "ok_list", "ok123", "ok456", 61 islessthan("$(test.sum)", "579.1"), 62 isgreaterthan("$(test.sum)", "578.9") 63 }; 64 65 reports: 66 DEBUG:: 67 "nums: $(nums)"; 68 "sum: $(test.sum)"; 69 ok:: 70 "$(this.promise_filename) Pass"; 71 !ok:: 72 "$(this.promise_filename) FAIL"; 73} 74 75