Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::PathBuf;

use anyhow::Result;
use anyhow::{Result, anyhow};
use clap::{Parser, Subcommand};

mod coverage;
Expand Down Expand Up @@ -38,15 +38,8 @@ enum Commands {
fn main() -> Result<()> {
let args = Cli::parse();
match &args.command {
Some(Commands::ImportAtp { input, output }) => {
import_atp(input, output)?;
}
Some(Commands::BuildCoverage { places, output }) => {
build_coverage(places, output)?;
}
None => {
eprintln!("no subcommand given");
}
Some(Commands::ImportAtp { input, output }) => import_atp(input, output),
Some(Commands::BuildCoverage { places, output }) => build_coverage(places, output),
None => Err(anyhow!("no subcommand given")),
}
Ok(())
}
8 changes: 8 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ fn test_pipeline() -> Result<()> {
Ok(())
}

#[test]
fn test_no_subcommand() {
Command::new(cargo_bin!("diffed-places"))
.assert()
.failure()
.stderr(predicates::str::contains("no subcommand given"));
}

#[test]
fn test_import_atp_bad_input_path() -> Result<()> {
let output = NamedTempFile::new()?;
Expand Down
Loading