summaryrefslogtreecommitdiff
path: root/src/tests/config.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-01-07 15:15:38 +0000
committerDaniel Mueller <deso@posteo.net>2020-01-07 15:15:38 +0000
commitc1f35ab538dbdf3002a6a9aa0932ada687160787 (patch)
tree965ade0fc53cebb3ad8da04144592031a68d0b26 /src/tests/config.rs
parentb9fbc489819a111f21eecb2b9a07a931dca1b8ce (diff)
downloadnitrocli-c1f35ab538dbdf3002a6a9aa0932ada687160787.tar.gz
nitrocli-c1f35ab538dbdf3002a6a9aa0932ada687160787.tar.bz2
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.
Diffstat (limited to 'src/tests/config.rs')
-rw-r--r--src/tests/config.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tests/config.rs b/src/tests/config.rs
index ea3a0e8..728fdbd 100644
--- a/src/tests/config.rs
+++ b/src/tests/config.rs
@@ -1,7 +1,7 @@
// config.rs
// *************************************************************************
-// * Copyright (C) 2019 Daniel Mueller (deso@posteo.net) *
+// * Copyright (C) 2019-2020 Daniel Mueller (deso@posteo.net) *
// * *
// * This program is free software: you can redistribute it and/or modify *
// * it under the terms of the GNU General Public License as published by *
@@ -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 <numlock>' cannot be used with '--no-numlock'"),
+ err,
);
}