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/evalfunction.c
Original file line number Diff line number Diff line change
Expand Up @@ -8276,7 +8276,7 @@ static bool ClassFilterDataObject(
break;
}

return true;
return false;
}

static FnCallResult FnCallClassFilterData(
Expand Down
59 changes: 59 additions & 0 deletions tests/acceptance/01_vars/02_functions/classfilterdata_foo.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
body common control
{
bundlesequence => { "check" };
}

bundle agent check
{
vars:
"object_of_arrays"
data => '{
"bar": "!foo",
"foo": [ "!foo", "foo&bar", "foo|bar" ],
}';
"object_of_arrays_filtered"
data => classfilterdata("object_of_arrays", "object_of_arrays", "0");

"object_of_objects"
data => '{
"bar": "!foo",
"foo": { "foo": "!bar", "key": "value" },
}';
"object_of_objects_filtered"
data => classfilterdata("object_of_objects", "object_of_objects", "foo");

"array_of_arrays"
data => '[
"bar",
[ "baz", "!baz", "foo&baz", "foo|baz" ],
]';
"array_of_arrays_filtered"
data => classfilterdata("array_of_arrays", "array_of_arrays", "0");

"array_of_objects"
data => '[
"bar",
{ "baz": "!baz", "key": "value" },
]';
"array_of_objects_filtered"
data => classfilterdata("array_of_objects", "array_of_objects", "baz");

classes:
"ok" not => or(
isvariable("array_of_arrays_filtered"),
isvariable("array_of_objects_filtered"),
isvariable("object_of_arrays_filtered"),
isvariable("object_of_objects_filtered")
);

reports:
"Object of Objects filtered: $(with)" with => string(@(object_of_objects_filtered));
"Object of Arrays filtered: $(with)" with => string(@(object_of_arrays_filtered));
"Array of Arrays filtered: $(with)" with => string(@(array_of_arrays_filtered));
"Array of Objects filtered: $(with)" with => string(@(array_of_objects_filtered));

ok::
"$(this.promise_filename) Pass";
!ok::
"$(this.promise_filename) FAIL";
}
Loading