Skip to content

Commit a2b241d

Browse files
enthropy7claude
andcommitted
Add integration tests for extra_cargo_args
Test that extra cargo args are forwarded to cargo during the prepare phase: a positive test with --quiet and a negative test with an invalid flag to prove args are actually passed through. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1e216da commit a2b241d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/buildtest/mod.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,37 @@ fn test_cargo_workspace() {
247247
});
248248
}
249249

250+
#[test]
251+
fn test_extra_cargo_args() {
252+
runner::run("hello-world", |run| {
253+
run.build(SandboxBuilder::new().enable_networking(false), |builder| {
254+
builder
255+
.extra_cargo_args(vec!["--quiet".into()])
256+
.run(|build| {
257+
build.cargo().args(&["run"]).run()?;
258+
Ok(())
259+
})
260+
})?;
261+
Ok(())
262+
});
263+
}
264+
265+
#[test]
266+
fn test_extra_cargo_args_invalid() {
267+
runner::run("hello-world", |run| {
268+
let res = run.build(SandboxBuilder::new().enable_networking(false), |builder| {
269+
builder
270+
.extra_cargo_args(vec!["--invalid-flag-that-does-not-exist".into()])
271+
.run(|_build| Ok(()))
272+
});
273+
assert!(
274+
res.is_err(),
275+
"expected extra cargo args to cause a prepare failure"
276+
);
277+
Ok(())
278+
});
279+
}
280+
250281
test_prepare_error!(
251282
test_missing_cargotoml,
252283
"missing-cargotoml",

0 commit comments

Comments
 (0)