Skip to content

Commit 2926000

Browse files
Added tests for checking validity of half-promises/macros
1 parent 7eccdc2 commit 2926000

4 files changed

Lines changed: 58 additions & 0 deletions

File tree

tests/lint/017_half_promises.cf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
bundle agent main
2+
{
3+
vars:
4+
"string" string => $(bar);
5+
6+
"string"
7+
@if minimum_version(3.18)
8+
string => $($(baz));
9+
@else
10+
string => $($(baz));
11+
@endif
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
string => $(bar);
3+
string => $(bar);
4+
^---------------^
5+
Error: Found promise attribute with no parent-promiser outside of a macro at tests/lint/017_half_promises.x.cf:6:7
6+
7+
string => $($(baz));
8+
string => $($(baz));
9+
^------------------^
10+
Error: Multiple promise attributes with ending semicolon found inside macro 'minimum_version(3.18)' at tests/lint/017_half_promises.x.cf:9:7
11+
12+
# comment
13+
string => $($(baz));
14+
^------------------^
15+
Error: Multiple promise attributes with ending semicolon found inside macro 'else' at tests/lint/017_half_promises.x.cf:26:7
16+
FAIL: tests/lint/017_half_promises.x.cf (3 errors)
17+
Failure, 3 errors in total.

tests/lint/017_half_promises.x.cf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
bundle agent main
2+
{
3+
vars:
4+
"string"
5+
string => $(bar);
6+
string => $(bar);
7+
@if minimum_version(3.18)
8+
string => $($(baz));
9+
string => $($(baz));
10+
@else
11+
string => $($(baz));
12+
@endif
13+
14+
"string"
15+
# comment
16+
# comment
17+
# comment
18+
@if minimum_version(3.20)
19+
string => $($(baz));
20+
21+
# comment
22+
@else
23+
string => $($(baz));
24+
25+
# comment
26+
string => $($(baz));
27+
# comment
28+
@endif
29+
}

0 commit comments

Comments
 (0)