@@ -152,6 +152,9 @@ 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 }},
155158 }
156159
157160 for _ , test := range tests {
@@ -236,6 +239,8 @@ func TestBuiltin_errors(t *testing.T) {
236239 {`now(nil)` , "invalid number of arguments (expected 0, got 1)" },
237240 {`date(nil)` , "interface {} is nil, not string (1:1)" },
238241 {`timezone(nil)` , "cannot use nil as argument (type string) to call timezone (1:10)" },
242+ {`flatten([1, 2], [3, 4])` , "invalid number of arguments (expected 1, got 2)" },
243+ {`flatten(1)` , "cannot flatten int" },
239244 }
240245 for _ , test := range errorTests {
241246 t .Run (test .input , func (t * testing.T ) {
0 commit comments