Skip to content

Commit 4aa05ba

Browse files
olehermanseclaude
andcommitted
Added formatting test for macros
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
1 parent 1dc9856 commit 4aa05ba

2 files changed

Lines changed: 169 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
bundle agent main
2+
{
3+
vars:
4+
"v" string => "hello";
5+
@if minimum_version(3.18)
6+
"new_var" string => "only in 3.18+";
7+
@endif
8+
reports:
9+
"Hello!";
10+
@if minimum_version(3.20)
11+
"New report";
12+
@endif
13+
}
14+
15+
bundle agent other
16+
{
17+
@if minimum_version(3.18)
18+
vars:
19+
"v" string => "value";
20+
@else
21+
vars:
22+
"v" string => "old_value";
23+
@endif
24+
}
25+
26+
@if minimum_version(3.18)
27+
bundle agent new_bundle
28+
{
29+
reports:
30+
"Only available in 3.18+";
31+
}
32+
@endif
33+
34+
bundle agent half_promises
35+
{
36+
vars:
37+
"promiser"
38+
@if minimum_version(3.18)
39+
string => "new_value";
40+
@else
41+
string => "old_value";
42+
@endif
43+
44+
"another"
45+
@if minimum_version(3.18)
46+
string => "new";
47+
@else
48+
string => "old";
49+
@endif
50+
}
51+
52+
bundle agent comments_and_macros
53+
{
54+
vars:
55+
# Comment before macro
56+
@if minimum_version(3.18)
57+
"v" string => "new";
58+
@endif
59+
# Comment after macro
60+
"w" string => "always";
61+
@if minimum_version(3.18)
62+
# Comment inside macro block
63+
"x" string => "new_with_comment";
64+
@endif
65+
reports:
66+
# Report comment
67+
@if minimum_version(3.20)
68+
# Another comment
69+
"New report";
70+
@endif
71+
"Always report";
72+
}
73+
74+
bundle agent half_with_comment
75+
{
76+
vars:
77+
# Comment before half promise
78+
"promiser"
79+
# Comment before macro in half promise
80+
@if minimum_version(3.18)
81+
string => "new_value";
82+
@else
83+
string => "old_value";
84+
@endif
85+
}

tests/format/011_macros.input.cf

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
bundle agent main
2+
{
3+
vars:
4+
"v" string => "hello";
5+
@if minimum_version(3.18)
6+
"new_var" string => "only in 3.18+";
7+
@endif
8+
reports:
9+
"Hello!";
10+
@if minimum_version(3.20)
11+
"New report";
12+
@endif
13+
}
14+
15+
bundle agent other
16+
{
17+
@if minimum_version(3.18)
18+
vars:
19+
"v" string => "value";
20+
@else
21+
vars:
22+
"v" string => "old_value";
23+
@endif
24+
}
25+
26+
@if minimum_version(3.18)
27+
bundle agent new_bundle
28+
{
29+
reports:
30+
"Only available in 3.18+";
31+
}
32+
@endif
33+
34+
bundle agent half_promises
35+
{
36+
vars:
37+
"promiser"
38+
@if minimum_version(3.18)
39+
string => "new_value";
40+
@else
41+
string => "old_value";
42+
@endif
43+
"another"
44+
@if minimum_version(3.18)
45+
string => "new";
46+
@else
47+
string => "old";
48+
@endif
49+
}
50+
51+
bundle agent comments_and_macros
52+
{
53+
vars:
54+
# Comment before macro
55+
@if minimum_version(3.18)
56+
"v" string => "new";
57+
@endif
58+
# Comment after macro
59+
"w" string => "always";
60+
@if minimum_version(3.18)
61+
# Comment inside macro block
62+
"x" string => "new_with_comment";
63+
@endif
64+
reports:
65+
# Report comment
66+
@if minimum_version(3.20)
67+
# Another comment
68+
"New report";
69+
@endif
70+
"Always report";
71+
}
72+
73+
bundle agent half_with_comment
74+
{
75+
vars:
76+
# Comment before half promise
77+
"promiser"
78+
# Comment before macro in half promise
79+
@if minimum_version(3.18)
80+
string => "new_value";
81+
@else
82+
string => "old_value";
83+
@endif
84+
}

0 commit comments

Comments
 (0)