@@ -971,26 +971,26 @@ mod tests {
971
971
}
972
972
#[ test]
973
973
fn test_eval_matches_with_captures ( ) -> Result < ( ) > {
974
- let mut ctx =
974
+ let ctx =
975
975
& mut EvalContext :: from ( [ ( "hello" . to_string ( ) , Value :: String ( "foobar" . to_string ( ) ) ) ] ) ;
976
976
977
- let result = evaluate_expression ( "$(hello) matches '^(fo)o'" , & mut ctx) ?;
977
+ let result = evaluate_expression ( "$(hello) matches '^(fo)o'" , ctx) ?;
978
978
assert_eq ! ( result, Value :: Boolean ( BoolValue :: True ) ) ;
979
979
980
- let result = evaluate_expression ( "$(MATCHES{1})" , & mut ctx) ?;
980
+ let result = evaluate_expression ( "$(MATCHES{1})" , ctx) ?;
981
981
assert_eq ! ( result, Value :: String ( "fo" . to_string( ) ) ) ;
982
982
Ok ( ( ) )
983
983
}
984
984
#[ test]
985
985
fn test_eval_matches_with_captures_and_match_name ( ) -> Result < ( ) > {
986
- let mut ctx =
986
+ let ctx =
987
987
& mut EvalContext :: from ( [ ( "hello" . to_string ( ) , Value :: String ( "foobar" . to_string ( ) ) ) ] ) ;
988
988
989
989
ctx. set_match_name ( "my_custom_name" ) ;
990
990
let result = evaluate_expression ( "$(hello) matches '^(fo)o'" , ctx) ?;
991
991
assert_eq ! ( result, Value :: Boolean ( BoolValue :: True ) ) ;
992
992
993
- let result = evaluate_expression ( "$(my_custom_name{1})" , & mut ctx) ?;
993
+ let result = evaluate_expression ( "$(my_custom_name{1})" , ctx) ?;
994
994
assert_eq ! ( result, Value :: String ( "fo" . to_string( ) ) ) ;
995
995
Ok ( ( ) )
996
996
}
@@ -1128,13 +1128,13 @@ mod tests {
1128
1128
1129
1129
#[ test]
1130
1130
fn test_bool_coercion ( ) -> Result < ( ) > {
1131
- assert_eq ! ( Value :: Boolean ( BoolValue :: True ) . to_bool( ) , true ) ;
1132
- assert_eq ! ( Value :: Boolean ( BoolValue :: False ) . to_bool( ) , false ) ;
1133
- assert_eq ! ( Value :: Integer ( 1 ) . to_bool( ) , true ) ;
1134
- assert_eq ! ( Value :: Integer ( 0 ) . to_bool( ) , false ) ;
1135
- assert_eq ! ( Value :: String ( "" . to_string( ) ) . to_bool( ) , false ) ;
1136
- assert_eq ! ( Value :: String ( "hello" . to_string( ) ) . to_bool( ) , true ) ;
1137
- assert_eq ! ( Value :: Null . to_bool( ) , false ) ;
1131
+ assert ! ( Value :: Boolean ( BoolValue :: True ) . to_bool( ) ) ;
1132
+ assert ! ( ! Value :: Boolean ( BoolValue :: False ) . to_bool( ) ) ;
1133
+ assert ! ( Value :: Integer ( 1 ) . to_bool( ) ) ;
1134
+ assert ! ( ! Value :: Integer ( 0 ) . to_bool( ) ) ;
1135
+ assert ! ( ! Value :: String ( "" . to_string( ) ) . to_bool( ) ) ;
1136
+ assert ! ( Value :: String ( "hello" . to_string( ) ) . to_bool( ) ) ;
1137
+ assert ! ( ! Value :: Null . to_bool( ) ) ;
1138
1138
1139
1139
Ok ( ( ) )
1140
1140
}
0 commit comments