1#######################################################
2#
3# Insert lines from a file, verify that whitespace_policy other than
4# ignore_trailing works when given a not-close-enough match
5#
6#######################################################
7
8body common control
9{
10      inputs => { "../../default.cf.sub" };
11      bundlesequence  => { default("$(this.promise_filename)") };
12      version => "1.0";
13}
14
15#######################################################
16
17bundle agent init
18{
19  vars:
20      "states" slist => { "actual", "expected", "insert" };
21
22      "actual" string =>
23      "BEGIN
24    One potato
25    Two potato
26    Two potatoes
27    Leading   embedded   and trailing spaces
28    Four
29END";
30
31      "insert" string =>
32      "    One potato
33    Two potato
34    Three potatoe
35  Leading embedded and trailing spaces
36    Four";
37
38      "expected" string =>
39      "BEGIN
40    One potato
41    Two potato
42    Two potatoes
43    Leading   embedded   and trailing spaces
44    Four
45END
46    Three potatoe
47  Leading embedded and trailing spaces";
48
49  files:
50      "$(G.testfile).$(states)"
51      create => "true",
52      edit_line => init_insert("$(init.$(states))"),
53      edit_defaults => init_empty;
54}
55
56bundle edit_line init_insert(str)
57{
58  insert_lines:
59      "$(str)";
60}
61
62body edit_defaults init_empty
63{
64      empty_file_before_editing => "true";
65}
66
67#######################################################
68
69bundle agent test
70{
71  files:
72      "$(G.testfile).actual"
73      edit_line => test_insert("$(G.testfile).insert");
74}
75
76bundle edit_line test_insert(filename)
77{
78  insert_lines:
79      "$(filename)"
80      insert_type => "file",
81      whitespace_policy => { "ignore_leading" };
82}
83
84#######################################################
85
86bundle agent check
87{
88  methods:
89      "any" usebundle => dcs_check_diff("$(G.testfile).actual",
90                                            "$(G.testfile).expected",
91                                            "$(this.promise_filename)");
92}
93
94### PROJECT_ID: core
95### CATEGORY_ID: 27
96