Skip to content

Commit

Permalink
fix setting default-true flags to false
Browse files Browse the repository at this point in the history
  • Loading branch information
dfrankland committed Dec 9, 2024
1 parent 104f48c commit f3b3fc2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cli-tests/src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ async fn upload_bundle_no_files_allow_missing_junit_files() {
}
};

args.push("--print-files");

let mut assert = Command::new(CARGO_RUN.path())
.current_dir(&temp_dir)
.env("TRUNK_PUBLIC_API_ADDRESS", &state.host)
Expand All @@ -340,7 +342,14 @@ async fn upload_bundle_no_files_allow_missing_junit_files() {
assert.success()
};

assert = assert.stderr(predicate::str::contains("unexpected argument").not());
let predicate_fn = predicate::str::contains("unexpected argument");

// `=` is required to set the flag to `false`
assert = if matches!(flag, Flag::Off | Flag::OffAlias) {
assert.stderr(predicate_fn)
} else {
assert.stderr(predicate_fn.not())
};

// HINT: View CLI output with `cargo test -- --nocapture`
println!("{assert}");
Expand Down
2 changes: 2 additions & 0 deletions cli/src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub struct UploadArgs {
help = "Run commands with the quarantining step.",
action = ArgAction::Set,
required = false,
require_equals = true,
num_args = 0..=1,
default_value = "true",
default_missing_value = "true",
Expand All @@ -99,6 +100,7 @@ pub struct UploadArgs {
help = "Do not fail if test results are not found.",
action = ArgAction::Set,
required = false,
require_equals = true,
num_args = 0..=1,
default_value = "true",
default_missing_value = "true",
Expand Down

0 comments on commit f3b3fc2

Please sign in to comment.