diff --git a/src/testkit.rs b/src/testkit.rs index c9b31b7..3ada89d 100644 --- a/src/testkit.rs +++ b/src/testkit.rs @@ -196,6 +196,17 @@ mod tests { } } + /// An answer with nothing in it (no words, no call) is asked again, in either format. + #[test] + fn an_empty_answer_is_asked_again() { + for (f, kind) in [(Fake::openai(vec![Reply::Empty, Reply::text("有了")]), ProviderKind::Custom), (Fake::anthropic(vec![Reply::Empty, Reply::text("有了")]), ProviderKind::Anthropic)] { + let cancel = AtomicBool::new(false); + let out = crate::providers::run_step(&req(kind, f.base()), &cancel, &|_| {}).unwrap(); + assert_eq!(out.text, "有了", "{kind:?}"); + assert_eq!(f.requests(), 2, "{kind:?}"); + } + } + /// A busy answer with Retry-After is waited out and asked again; a dropped connection too. #[test] fn busy_and_dropped_answers_are_tried_again() {