1#######################################################
2#
3# Insert lines from a variable, verify that whitespace_policy other than
4# ignore_leading 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" };
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("$(init.insert)");
74}
75
76bundle edit_line test_insert(lines)
77{
78  insert_lines:
79      "$(lines)"
80      whitespace_policy => { "ignore_trailing" };
81}
82
83#######################################################
84
85bundle agent check
86{
87  methods:
88      "any" usebundle => dcs_check_diff("$(G.testfile).actual",
89                                            "$(G.testfile).expected",
90                                            "$(this.promise_filename)");
91}
92
93### PROJECT_ID: core
94### CATEGORY_ID: 27
95