()
| 115 | |
| 116 | #[tokio::test] |
| 117 | async fn respects_result_limit() { |
| 118 | let provider = StaticContextProvider::from_items( |
| 119 | "static", |
| 120 | [ |
| 121 | ContextItem::new("a", ContextType::Resource, "a").with_token_count(1), |
| 122 | ContextItem::new("b", ContextType::Resource, "b").with_token_count(1), |
| 123 | ], |
| 124 | ); |
| 125 | |
| 126 | let result = provider |
| 127 | .query(&ContextQuery::new("prompt").with_max_results(1)) |
| 128 | .await |
| 129 | .unwrap(); |
| 130 | |
| 131 | assert_eq!(result.items.len(), 1); |
| 132 | assert!(result.truncated); |
| 133 | } |
| 134 | |
| 135 | #[tokio::test] |
| 136 | async fn truncates_oversized_single_item() { |
nothing calls this directly
no test coverage detected