@@ -152,6 +152,11 @@ func TestBuiltin(t *testing.T) {
152152 {`reduce([], 5, 0)` , 0 },
153153 {`concat(ArrayOfString, ArrayOfInt)` , []any {"foo" , "bar" , "baz" , 1 , 2 , 3 }},
154154 {`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 }}},
155160 }
156161
157162 for _ , test := range tests {
@@ -236,6 +241,8 @@ func TestBuiltin_errors(t *testing.T) {
236241 {`now(nil)` , "invalid number of arguments (expected 0, got 1)" },
237242 {`date(nil)` , "interface {} is nil, not string (1:1)" },
238243 {`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" },
239246 }
240247 for _ , test := range errorTests {
241248 t .Run (test .input , func (t * testing.T ) {
0 commit comments