@@ -152,6 +152,11 @@ func TestBuiltin(t *testing.T) {
152
152
{`reduce([], 5, 0)` , 0 },
153
153
{`concat(ArrayOfString, ArrayOfInt)` , []any {"foo" , "bar" , "baz" , 1 , 2 , 3 }},
154
154
{`concat(PtrArrayWithNil, [nil])` , []any {42 , nil }},
155
+ {`flatten([["a", "b"], [1, 2]])` , []any {"a" , "b" , 1 , 2 }},
156
+ {`flatten([["a", "b"], [1, 2, [3, 4]]])` , []any {"a" , "b" , 1 , 2 , 3 , 4 }},
157
+ {`flatten([["a", "b"], [1, 2, [3, [[[["c", "d"], "e"]]], 4]]])` , []any {"a" , "b" , 1 , 2 , 3 , "c" , "d" , "e" , 4 }},
158
+ {`uniq([1, 15, "a", 2, 3, 5, 2, "a", 2, "b"])` , []any {1 , 15 , "a" , 2 , 3 , 5 , "b" }},
159
+ {`uniq([[1, 2], "a", 2, 3, [1, 2], [1, 3]])` , []any {[]any {1 , 2 }, "a" , 2 , 3 , []any {1 , 3 }}},
155
160
}
156
161
157
162
for _ , test := range tests {
@@ -236,6 +241,8 @@ func TestBuiltin_errors(t *testing.T) {
236
241
{`now(nil)` , "invalid number of arguments (expected 0, got 1)" },
237
242
{`date(nil)` , "interface {} is nil, not string (1:1)" },
238
243
{`timezone(nil)` , "cannot use nil as argument (type string) to call timezone (1:10)" },
244
+ {`flatten([1, 2], [3, 4])` , "invalid number of arguments (expected 1, got 2)" },
245
+ {`flatten(1)` , "cannot flatten int" },
239
246
}
240
247
for _ , test := range errorTests {
241
248
t .Run (test .input , func (t * testing.T ) {
0 commit comments