From 8482335491aa55b0458ffedccd1fc110f092e38a Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Tue, 7 Jan 2020 15:15:38 +0000 Subject: Replace argparse with structopt This patch changes the argument handling code to use structopt instead of argparse using the data structures we introduced in the last patch. As part of that transition we replace the old Error::ArgparseError variant with ClapError that stores a structopt::clap::Error. Because of that replacement, the format of the help messages changed, breaking some of the tests. Hence, this change adapts them accordingly. Also clap currently prints the version output to stdout, so we ignore the version_option test case for now. --- nitrocli/src/tests/config.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'nitrocli/src/tests/config.rs') diff --git a/nitrocli/src/tests/config.rs b/nitrocli/src/tests/config.rs index ea3a0e8..9ff3f73 100644 --- a/nitrocli/src/tests/config.rs +++ b/nitrocli/src/tests/config.rs @@ -39,9 +39,10 @@ $"#, #[test_device] fn set_wrong_usage(model: nitrokey::Model) { let res = Nitrocli::with_model(model).handle(&["config", "set", "--numlock", "2", "-N"]); - assert_eq!( - res.unwrap_str_err(), - "--numlock and --no-numlock are mutually exclusive" + let err = res.unwrap_str_err(); + assert!( + err.contains("The argument '--numlock ' cannot be used with '--no-numlock'"), + err, ); } -- cgit v1.2.1