Skip to content

Commit

Permalink
- Added UT
Browse files Browse the repository at this point in the history
  • Loading branch information
jczaja committed Mar 24, 2024
1 parent 486f900 commit 8575604
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,26 @@ mod tests {
Ok(())
}

#[test]
fn test_unrecognized_file_taxation() -> Result<(), clap::Error> {
// Get all brokerage with dividends only
let myapp = App::new("E-trade tax helper").setting(AppSettings::ArgRequiredElseHelp);
let rd: Box<dyn etradeTaxReturnHelper::Residency> = Box::new(pl::PL {});
// Check printed values or returned values?
let matches = create_cmd_line_pattern(myapp)
.get_matches_from_safe(vec!["mytest", "unrecognized_file.txt"])?;

let pdfnames = matches
.values_of("financial documents")
.expect_and_log("error getting financial documents names");
let pdfnames: Vec<String> = pdfnames.map(|x| x.to_string()).collect();

match etradeTaxReturnHelper::run_taxation(&rd, pdfnames) {
Ok(_) => panic!("Expected an error from run_taxation, but got Ok"),
Err(_) => Ok(()), // Expected error, test passes
}
}

#[test]
#[ignore]
fn test_dividends_taxation() -> Result<(), clap::Error> {
Expand Down

0 comments on commit 8575604

Please sign in to comment.