@@ -288,7 +288,10 @@ mod tests {
288288 use std:: collections:: HashMap ;
289289
290290 use super :: * ;
291- use crate :: cli:: agent:: { Agent , ToolSettingTarget } ;
291+ use crate :: cli:: agent:: {
292+ Agent ,
293+ ToolSettingTarget ,
294+ } ;
292295
293296 #[ test]
294297 fn test_requires_acceptance_for_readonly_commands ( ) {
@@ -620,14 +623,14 @@ mod tests {
620623
621624 #[ tokio:: test]
622625 async fn test_eval_perm_denied_commands_invalid_regex ( ) {
623-
624626 let os = Os :: new ( ) . await . unwrap ( ) ;
627+ let tool_name = if cfg ! ( windows) { "execute_cmd" } else { "execute_bash" } ;
625628 let agent = Agent {
626629 name : "test_agent" . to_string ( ) ,
627630 tools_settings : {
628631 let mut map = HashMap :: < ToolSettingTarget , serde_json:: Value > :: new ( ) ;
629632 map. insert (
630- ToolSettingTarget ( "execute_bash" . to_string ( ) ) ,
633+ ToolSettingTarget ( tool_name . to_string ( ) ) ,
631634 serde_json:: json!( {
632635 "deniedCommands" : [ "^(?!ls$).*" ] // Invalid regex with unsupported lookahead
633636 } ) ,
@@ -640,7 +643,11 @@ mod tests {
640643 // Test command that should be denied by the pattern
641644 let pwd_cmd = serde_json:: from_value :: < ExecuteCommand > ( serde_json:: json!( { "command" : "pwd" , } ) ) . unwrap ( ) ;
642645 let res = pwd_cmd. eval_perm ( & os, & agent) ;
643- assert ! ( matches!( res, PermissionEvalResult :: Deny ( _) ) , "Invalid regex should deny all commands, got {:?}" , res) ;
646+ assert ! (
647+ matches!( res, PermissionEvalResult :: Deny ( _) ) ,
648+ "Invalid regex should deny all commands, got {:?}" ,
649+ res
650+ ) ;
644651 }
645652
646653 #[ tokio:: test]
0 commit comments