Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libpromises/cf3lex.l
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ promise promise

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.:]+[\]]+[}]

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

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

Expand Down
107 changes: 107 additions & 0 deletions tests/acceptance/01_vars/01_basic/namespaces/unquoted_namespaces.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
body common control
{
inputs => { "../../../default.cf.sub"};
bundlesequence => { "init", "test", "new_namespace:check" };
version => "1.0";
}

bundle agent init
{
meta:
"description" -> { "ENT-13304" }
string => "Test that quotes are not needed for a fully qualified variable name in a function call";
}

bundle agent test
{
vars:
"foo_list"
slist => { "1", "2", "3" };
}

body file control
{
namespace => "new_namespace";
}

bundle agent check
{
vars:
"bar_list"
slist => { "1", "2", "3" };

"unquoted_foo_list1"
string => join(", ", foo_list);

"unquoted_foo_list2"
string => join(", ", test.foo_list);

"unquoted_foo_list3"
string => join(", ", default:foo_list);

"unquoted_foo_list4"
string => join(", ", default:test.foo_list);

"unquoted_bar_list1"
string => join(", ", bar_list);

"unquoted_bar_list2"
string => join(", ", check.bar_list);

"unquoted_bar_list3"
string => join(", ", new_namespace:bar_list);

"unquoted_bar_list4"
string => join(", ", new_namespace:check.bar_list);

"quoted_foo_list1"
string => join(", ", foo_list);

"quoted_foo_list2"
string => join(", ", test.foo_list);

"quoted_foo_list3"
string => join(", ", default:foo_list);

"quoted_foo_list4"
string => join(", ", default:test.foo_list);

"quoted_bar_list1"
string => join(", ", bar_list);

"quoted_bar_list2"
string => join(", ", check.bar_list);

"quoted_bar_list3"
string => join(", ", new_namespace:bar_list);

"quoted_bar_list4"
string => join(", ", new_namespace:check.bar_list);

classes:
"undefined_vars"
expression => not(or(isvariable("unquoted_foo_list1"),
isvariable("unquoted_foo_list3"),
isvariable("unquoted_bar_list2"),
isvariable("quoted_foo_list1"),
isvariable("quoted_foo_list3"),
isvariable("quoted_bar_list2")));

"defined_vars"
expression => and(strcmp("1, 2, 3", "$(unquoted_foo_list2)"),
strcmp("1, 2, 3", "$(unquoted_foo_list4)"),
strcmp("1, 2, 3", "$(unquoted_bar_list1)"),
strcmp("1, 2, 3", "$(unquoted_bar_list3)"),
strcmp("1, 2, 3", "$(unquoted_bar_list4)"),
strcmp("1, 2, 3", "$(quoted_foo_list2)"),
strcmp("1, 2, 3", "$(quoted_foo_list4)"),
strcmp("1, 2, 3", "$(quoted_bar_list1)"),
strcmp("1, 2, 3", "$(quoted_bar_list3)"),
strcmp("1, 2, 3", "$(quoted_bar_list4)"));

reports:
defined_vars.undefined_vars::
"$(this.promise_filename) Pass";
!defined_vars|!undefined_vars::
"$(this.promise_filename) FAIL";
}
Loading