Skip to content

Commit b305ad5

Browse files
Added tests for invalid number of arguments in function calls
1 parent 746ecef commit b305ad5

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
bundle agent main
2+
{
3+
vars:
4+
"users1"
5+
slist => getusers(); # This is valid, zero args will not filter any, not caught at all, syntax-desc shows 2 params
6+
"users2"
7+
slist => getusers("a");
8+
"users3"
9+
slist => getusers("a", "b");
10+
"users4"
11+
slist => getusers("a", "b", "c", "d"); # This is allowed to run, but the c and d gets ignored
12+
"file1"
13+
string => readfile(); # Should fail
14+
"file2"
15+
string => readfile("/tmp/tmp.txt"); # Valid
16+
"file3"
17+
string => readfile("/tmp/tmp.txt", "100", "/tmp/tmp2.txt"); # Valid but shouldnt be, tmp2 gets ignored
18+
reports:
19+
"found user1 $(users1)";
20+
"found user2 $(users2)";
21+
"found user3 $(users3)";
22+
"found user4 $(users4)";
23+
"found file1 $(file1)";
24+
"found file2 $(file2)";
25+
"found file3 $(file3)";
26+
}

0 commit comments

Comments
 (0)