@@ -799,7 +799,7 @@ mod tests {
799799 use crate :: ast:: logical_expr:: LogicalExpr ;
800800 use crate :: execution_context:: ExecutionContext ;
801801 use crate :: functions:: {
802- CompiledFunction , FunctionArgKind , FunctionArgs , FunctionDefinition ,
802+ AllFunction , CompiledFunction , FunctionArgKind , FunctionArgs , FunctionDefinition ,
803803 FunctionDefinitionContext , FunctionParam , FunctionParamError , SimpleFunctionDefinition ,
804804 SimpleFunctionImpl , SimpleFunctionOptParam , SimpleFunctionParam ,
805805 } ;
@@ -967,6 +967,8 @@ mod tests {
967967 tcp. port: Int ,
968968 tcp. ports: Array ( Int ) ,
969969 array. of. bool : Array ( Bool ) ,
970+ map. bool . arr: Map ( Array ( Bool ) ) ,
971+ map. bytes. arr: Map ( Array ( Bytes ) ) ,
970972 http. parts: Array ( Array ( Bytes ) ) ,
971973 } ;
972974 builder
@@ -983,6 +985,7 @@ mod tests {
983985 } ,
984986 )
985987 . unwrap ( ) ;
988+ builder. add_function ( "all" , AllFunction :: default ( ) ) . unwrap ( ) ;
986989 builder
987990 . add_function (
988991 "echo" ,
@@ -2633,6 +2636,34 @@ mod tests {
26332636 assert_eq ! ( expr. execute_one( ctx) , false ) ;
26342637 }
26352638
2639+ #[ test]
2640+ fn test_any_all_functions_with_missing_arrays ( ) {
2641+ let ctx = & mut ExecutionContext :: new ( & SCHEME ) ;
2642+ ctx. set_field_value (
2643+ field ( "map.bool.arr" ) ,
2644+ Map :: new ( Type :: Array ( Type :: Bool . into ( ) ) ) ,
2645+ )
2646+ . unwrap ( ) ;
2647+ ctx. set_field_value (
2648+ field ( "map.bytes.arr" ) ,
2649+ Map :: new ( Type :: Array ( Type :: Bytes . into ( ) ) ) ,
2650+ )
2651+ . unwrap ( ) ;
2652+
2653+ let execute = |input| SCHEME . parse ( input) . unwrap ( ) . compile ( ) . execute ( ctx) . unwrap ( ) ;
2654+
2655+ assert_eq ! ( execute( r#"any(map.bool.arr["missing"])"# ) , false ) ;
2656+ assert_eq ! ( execute( r#"all(map.bool.arr["missing"])"# ) , false ) ;
2657+ assert_eq ! (
2658+ execute( r#"any(map.bytes.arr["missing"][*] matches "bar")"# ) ,
2659+ false
2660+ ) ;
2661+ assert_eq ! (
2662+ execute( r#"all(map.bytes.arr["missing"][*] matches "bar")"# ) ,
2663+ true
2664+ ) ;
2665+ }
2666+
26362667 #[ test]
26372668 fn test_map_each_nested ( ) {
26382669 let expr = assert_ok ! (
0 commit comments