AssertToolError 断言工具执行失败
(t *testing.T, result map[string]any)
| 317 | |
| 318 | // AssertToolError 断言工具执行失败 |
| 319 | func AssertToolError(t *testing.T, result map[string]any) string { |
| 320 | if ok, exists := result["ok"]; exists && ok.(bool) { |
| 321 | t.Errorf("Expected tool to fail, but it succeeded") |
| 322 | } |
| 323 | |
| 324 | if errMsg, exists := result["error"]; exists { |
| 325 | if errStr, ok := errMsg.(string); ok { |
| 326 | return errStr |
| 327 | } |
| 328 | } |
| 329 | t.Errorf("Expected error message in result, got: %+v", result) |
| 330 | return "" |
| 331 | } |
| 332 | |
| 333 | // AssertContains 断言字符串包含子字符串 |
| 334 | func AssertContains(t *testing.T, str, substr string) { |
no outgoing calls