Skip to content

Commit c901314

Browse files
authored
Merge pull request #6014 from victormlg/quoteless_vars
ENT-13304: Fixed qualified variable names in function calls
2 parents e1886c3 + ea7debb commit c901314

File tree

2 files changed

+109
-1
lines changed

2 files changed

+109
-1
lines changed

libpromises/cf3lex.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ promise promise
107107

108108
nakedvar [$@][(][a-zA-Z0-9_\[\]\200-\377.:]+[)]|[$@][{][a-zA-Z0-9_\[\]\200-\377.:]+[}]|[$@][(][a-zA-Z0-9_\200-\377.:]+[\[][a-zA-Z0-9_$(){}\200-\377.:]+[\]]+[)]|[$@][{][a-zA-Z0-9_\200-\377.:]+[\[][a-zA-Z0-9_$(){}\200-\377.:]+[\]]+[}]
109109

110-
identifier [a-zA-Z0-9_\200-\377]+
110+
identifier ([a-zA-Z0-9_\200-\377]+:)?([a-zA-Z0-9_\200-\377]+\.)?[a-zA-Z0-9_\200-\377]+
111111

112112
symbol [a-zA-Z0-9_\200-\377]+[:][a-zA-Z0-9_\200-\377]+
113113

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
body common control
2+
{
3+
inputs => { "../../../default.cf.sub"};
4+
bundlesequence => { "init", "test", "new_namespace:check" };
5+
version => "1.0";
6+
}
7+
8+
bundle agent init
9+
{
10+
11+
}
12+
13+
bundle agent test
14+
{
15+
meta:
16+
"description" -> { "ENT-13304" }
17+
string => "Test that quotes are not needed for a fully qualified variable name in a function call";
18+
vars:
19+
"foo_list"
20+
slist => { "1", "2", "3" };
21+
}
22+
23+
body file control
24+
{
25+
namespace => "new_namespace";
26+
}
27+
28+
bundle agent check
29+
{
30+
vars:
31+
"bar_list"
32+
slist => { "1", "2", "3" };
33+
34+
"unquoted_foo_list1"
35+
string => join(", ", foo_list);
36+
37+
"unquoted_foo_list2"
38+
string => join(", ", test.foo_list);
39+
40+
"unquoted_foo_list3"
41+
string => join(", ", default:foo_list);
42+
43+
"unquoted_foo_list4"
44+
string => join(", ", default:test.foo_list);
45+
46+
"unquoted_bar_list1"
47+
string => join(", ", bar_list);
48+
49+
"unquoted_bar_list2"
50+
string => join(", ", check.bar_list);
51+
52+
"unquoted_bar_list3"
53+
string => join(", ", new_namespace:bar_list);
54+
55+
"unquoted_bar_list4"
56+
string => join(", ", new_namespace:check.bar_list);
57+
58+
"quoted_foo_list1"
59+
string => join(", ", foo_list);
60+
61+
"quoted_foo_list2"
62+
string => join(", ", test.foo_list);
63+
64+
"quoted_foo_list3"
65+
string => join(", ", default:foo_list);
66+
67+
"quoted_foo_list4"
68+
string => join(", ", default:test.foo_list);
69+
70+
"quoted_bar_list1"
71+
string => join(", ", bar_list);
72+
73+
"quoted_bar_list2"
74+
string => join(", ", check.bar_list);
75+
76+
"quoted_bar_list3"
77+
string => join(", ", new_namespace:bar_list);
78+
79+
"quoted_bar_list4"
80+
string => join(", ", new_namespace:check.bar_list);
81+
82+
classes:
83+
"undefined_vars"
84+
expression => not(or(isvariable("unquoted_foo_list1"),
85+
isvariable("unquoted_foo_list3"),
86+
isvariable("unquoted_bar_list2"),
87+
isvariable("quoted_foo_list1"),
88+
isvariable("quoted_foo_list3"),
89+
isvariable("quoted_bar_list2")));
90+
91+
"defined_vars"
92+
expression => and(strcmp("1, 2, 3", "$(unquoted_foo_list2)"),
93+
strcmp("1, 2, 3", "$(unquoted_foo_list4)"),
94+
strcmp("1, 2, 3", "$(unquoted_bar_list1)"),
95+
strcmp("1, 2, 3", "$(unquoted_bar_list3)"),
96+
strcmp("1, 2, 3", "$(unquoted_bar_list4)"),
97+
strcmp("1, 2, 3", "$(quoted_foo_list2)"),
98+
strcmp("1, 2, 3", "$(quoted_foo_list4)"),
99+
strcmp("1, 2, 3", "$(quoted_bar_list1)"),
100+
strcmp("1, 2, 3", "$(quoted_bar_list3)"),
101+
strcmp("1, 2, 3", "$(quoted_bar_list4)"));
102+
103+
reports:
104+
defined_vars.undefined_vars::
105+
"$(this.promise_filename) Pass";
106+
!defined_vars|!undefined_vars::
107+
"$(this.promise_filename) FAIL";
108+
}

0 commit comments

Comments
 (0)