mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-18 06:34:26 +01:00
fix: Check for stderr error in receive() (#2905)
This commit is contained in:
@@ -22,6 +22,17 @@ async fn main() -> Result<()> {
|
||||
test_transport(sse_transport().await?).await?;
|
||||
test_transport(stdio_transport().await?).await?;
|
||||
|
||||
// Test broken transport
|
||||
match test_transport(broken_stdio_transport().await?).await {
|
||||
Ok(_) => assert!(false, "Expected an error but got success"),
|
||||
Err(e) => {
|
||||
assert!(e
|
||||
.to_string()
|
||||
.contains("error: package(s) `thispackagedoesnotexist` not found in workspace"));
|
||||
println!("Expected error occurred: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -52,6 +63,17 @@ async fn stdio_transport() -> Result<StdioTransport> {
|
||||
))
|
||||
}
|
||||
|
||||
async fn broken_stdio_transport() -> Result<StdioTransport> {
|
||||
Ok(StdioTransport::new(
|
||||
"cargo",
|
||||
vec!["run", "-p", "thispackagedoesnotexist"]
|
||||
.into_iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect(),
|
||||
HashMap::new(),
|
||||
))
|
||||
}
|
||||
|
||||
async fn test_transport<T>(transport: T) -> Result<()>
|
||||
where
|
||||
T: Transport + Send + 'static,
|
||||
|
||||
Reference in New Issue
Block a user