Skip to content

Commit

Permalink
Update tests, don't use Default
Browse files Browse the repository at this point in the history
  • Loading branch information
HadrienG2 committed Oct 23, 2023
1 parent 20c9e8c commit 5b21d35
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ enum SemverChecksCommands {
CheckRelease(CheckRelease),
}

#[derive(Debug, Args, Default)]
#[derive(Debug, Args, Clone)]
struct CheckRelease {
#[command(flatten, next_help_heading = "Current")]
pub manifest: clap_cargo::Manifest,
Expand Down Expand Up @@ -362,13 +362,16 @@ fn verify_cli() {
#[test]
fn features_empty_string_is_no_op() {
use cargo_semver_checks::Check;
let without_features = CheckRelease::default();
let with_empty_features = CheckRelease {
features: vec!["".to_owned()],
..CheckRelease::default()
use clap::{ArgMatches, FromArgMatches};

let no_args = ArgMatches::default();
let no_features = CheckRelease::from_arg_matches(&no_args).unwrap();
let empty_features = CheckRelease {
features: vec![String::new()],
current_features: vec![String::new(), String::new()],
baseline_features: vec![String::new()],
..no_features.clone()
};
assert_eq!(
Check::from(without_features),
Check::from(with_empty_features)
);

assert_eq!(Check::from(no_features), Check::from(empty_features));
}

0 comments on commit 5b21d35

Please sign in to comment.