1####################################################### 2# 3# Insert lines from a variable, verify that pairs of whitespace_policy work 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 "states" slist => { "actual", "expected" }; 20 21 "actual" string => 22 "BEGIN 23 One potato 24 Two potato 25 Two potatoes 26 Leading embedded and trailing spaces 27 Four 28END"; 29 30 "insert" string => 31 " One potato 32 Two potato 33 Three potatoe 34 Leading embedded and trailing spaces 35 Four"; 36 37 "expected" string => 38 "BEGIN 39 One potato 40 Two potato 41 Two potatoes 42 Leading embedded and trailing spaces 43 Four 44END 45 Three potatoe 46 Leading embedded and trailing spaces"; 47 48 files: 49 "$(G.testfile).$(states)" 50 create => "true", 51 edit_line => init_insert("$(init.$(states))"), 52 edit_defaults => init_empty; 53} 54 55bundle edit_line init_insert(str) 56{ 57 insert_lines: 58 "$(str)"; 59} 60 61body edit_defaults init_empty 62{ 63 empty_file_before_editing => "true"; 64} 65 66####################################################### 67 68bundle agent test 69{ 70 files: 71 "$(G.testfile).actual" 72 edit_line => test_insert("$(init.insert)"); 73} 74 75bundle edit_line test_insert(lines) 76{ 77 insert_lines: 78 "$(lines)" 79 whitespace_policy => { "ignore_leading", "ignore_trailing" }; 80} 81 82####################################################### 83 84bundle agent check 85{ 86 methods: 87 "any" usebundle => dcs_check_diff("$(G.testfile).actual", 88 "$(G.testfile).expected", 89 "$(this.promise_filename)"); 90} 91 92### PROJECT_ID: core 93### CATEGORY_ID: 27 94