1####################################################### 2# 3# Test filter() 4# 5####################################################### 6 7body common control 8{ 9 inputs => { "../../default.cf.sub" }; 10 bundlesequence => { default("$(this.promise_filename)") }; 11 version => "1.0"; 12} 13 14bundle agent init 15{ 16 vars: 17 "results" slist => { 18 "five trailing spaces ", 19 "no trailing spaces", 20 }; 21 22 files: 23 "$(G.testfile)" 24 create => "true", 25 edit_defaults => init_empty, 26 edit_line => init_insert; 27} 28 29 30body edit_defaults init_empty 31{ 32 empty_file_before_editing => "true"; 33 edit_backup => "false"; 34} 35 36bundle edit_line init_insert 37{ 38 insert_lines: 39 "$(init.results)"; 40} 41 42 43bundle agent test 44{ 45 classes: 46 "matched1" 47 expression => regline("five trailing spaces ", 48 $(G.testfile)), 49 scope => "namespace"; 50 "matched2" 51 expression => regline("five trailing spaces ", 52 $(G.testfile)), 53 scope => "namespace"; 54 55 56 57 reports: 58 DEBUG.matched1:: 59 "Line matched1 matched"; 60 DEBUG.!matched1:: 61 "Line matched1 did not match"; 62 DEBUG.matched2:: 63 "Line matched2 matched"; 64 DEBUG.!matched2:: 65 "Line matched2 did not match"; 66 67} 68 69bundle agent check 70{ 71 classes: 72 "ok" expression => "matched1.!matched2"; 73 74 reports: 75 ok:: 76 "$(this.promise_filename) Pass"; 77 !ok:: 78 "$(this.promise_filename) FAIL"; 79 80} 81