diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/tools.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/tools.rs b/tests/tools.rs index 77c1698..a400df0 100644 --- a/tests/tools.rs +++ b/tests/tools.rs | |||
| @@ -419,3 +419,18 @@ fn glob_follows_file_symlinks_but_not_directories() { | |||
| 419 | assert!(text.contains("link.rs"), "{text}"); | 419 | assert!(text.contains("link.rs"), "{text}"); |
| 420 | assert!(text.contains("inner.rs"), "{text}"); | 420 | assert!(text.contains("inner.rs"), "{text}"); |
| 421 | } | 421 | } |
| 422 | |||
| 423 | #[test] | ||
| 424 | fn validate_rejects_calls_that_cannot_run() { | ||
| 425 | use agent686::tools::validate; | ||
| 426 | |||
| 427 | assert!(validate("bash", &json!({ "cmd": "" })).is_err()); | ||
| 428 | assert!(validate("bash", &json!({})).is_err()); | ||
| 429 | assert!(validate("bash", &json!({ "cmd": "ls" })).is_ok()); | ||
| 430 | |||
| 431 | assert!(validate("read", &json!({ "path": " " })).is_err()); | ||
| 432 | assert!(validate("edit", &json!({ "path": "a", "old": "" })).is_err()); | ||
| 433 | assert!(validate("grep", &json!({ "pattern": "" })).is_err()); | ||
| 434 | // Empty content is how you create an empty file. | ||
| 435 | assert!(validate("write", &json!({ "path": "a", "content": "" })).is_ok()); | ||
| 436 | } | ||
