Skip to main content

assert_test_passed

Function assert_test_passed 

Source
pub fn assert_test_passed(result: &PromptTestResult)
Expand description

Assert that all built-in assertions in the test config passed.

This is a convenience function for checking that all assertions configured in the test (like expected_contains, min_response_length, etc.) passed.

§Examples

let client = Anthropic::new(None)?;
let config = PromptTestConfig::new("What is 2 + 2?")
    .expect_contains("4");
let result = config.run(&client).await?;
assert_test_passed(&result);

§Panics

Panics if any of the built-in assertions failed.