Skip to content

Commit

Permalink
Make run_args optional in CairoCoverageArgs (#124)
Browse files Browse the repository at this point in the history
<!-- Reference any GitHub issues resolved by this PR -->


## Introduced changes

<!-- A brief description of the changes -->

- as in title

## Checklist

<!-- Make sure all of these are complete -->

- [ ] Linked relevant issue
- [ ] Updated relevant documentation
- [ ] Added relevant tests
- [x] Performed self-review of the code
- [ ] Added changes to `CHANGELOG.md`
  • Loading branch information
ksew1 authored Dec 19, 2024
1 parent 4b9a7f4 commit cb25168
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/cairo-coverage/src/args/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct CairoCoverageArgs {
/// Arguments for the `run` subcommand so user can use
/// `cairo-coverage` without specifying the subcommand.
#[clap(flatten)]
pub run_args: RunArgs,
pub run_args: Option<RunArgs>,
/// Subcommand and its arguments.
#[command(subcommand)]
pub command: Option<Command>,
Expand Down
4 changes: 3 additions & 1 deletion crates/cairo-coverage/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ fn main() -> Result<()> {
// TODO:
// * In 0.5.0 add deprecation warning
// * In 0.6.0 remove the default command
None => Command::Run(cairo_coverage_args.run_args),
None => Command::Run(cairo_coverage_args.run_args.unwrap_or_else(|| {
unreachable!("`run_args` should be set when no subcommand is provided")
})),
};

commands::run(command)
Expand Down
1 change: 1 addition & 0 deletions crates/cairo-coverage/tests/helpers/test_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ impl TestProject {
fn run_coverage(self) -> Self {
let trace_files = self.find_trace_files();
SnapboxCommand::new(cargo_bin!("cairo-coverage"))
.arg("run")
.args(&trace_files)
.args(&self.coverage_args)
.current_dir(&self.dir)
Expand Down

0 comments on commit cb25168

Please sign in to comment.