mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
delete weird test
This commit is contained in:
@@ -453,48 +453,3 @@ fn heuristics_match_is_returned_when_no_policy_matches() {
|
||||
evaluation
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn heuristics_only_runs_for_commands_without_policy_matches() {
|
||||
let policy_src = r#"
|
||||
prefix_rule(
|
||||
pattern = ["git"],
|
||||
decision = "allow",
|
||||
)
|
||||
"#;
|
||||
let mut parser = PolicyParser::new();
|
||||
parser
|
||||
.parse("policy.codexpolicy", policy_src)
|
||||
.expect("parse policy");
|
||||
let policy = parser.build();
|
||||
|
||||
let commands = vec![tokens(&["git", "status"]), tokens(&["python"])];
|
||||
let heuristics_calls = Arc::new(Mutex::new(Vec::new()));
|
||||
let heuristics_call_log = Arc::clone(&heuristics_calls);
|
||||
let heuristics = move |cmd: &[String]| {
|
||||
heuristics_call_log
|
||||
.lock()
|
||||
.expect("lock heuristics call log")
|
||||
.push(cmd.to_vec());
|
||||
Decision::Prompt
|
||||
};
|
||||
|
||||
let evaluation = policy.check_multiple(&commands, &heuristics);
|
||||
|
||||
assert_eq!(Decision::Prompt, evaluation.decision);
|
||||
assert!(evaluation.matched_rules.iter().any(|rule_match| {
|
||||
matches!(
|
||||
rule_match,
|
||||
RuleMatch::HeuristicsRuleMatch {
|
||||
command,
|
||||
decision: Decision::Prompt
|
||||
} if command == &tokens(&["python"])
|
||||
)
|
||||
}));
|
||||
assert_eq!(
|
||||
vec![tokens(&["python"])],
|
||||
*heuristics_calls
|
||||
.lock()
|
||||
.expect("lock heuristics call log after evaluation")
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user