aboutsummaryrefslogtreecommitdiff
path: root/nitrocli/src/tests/mod.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-08-22 08:20:22 -0700
committerDaniel Mueller <deso@posteo.net>2019-08-22 08:20:22 -0700
commit560152b074e017753517f1d3c6e4431410ebed4b (patch)
tree3e1d13bdbe15562f15c30a1d3e8f72ac71f53a37 /nitrocli/src/tests/mod.rs
parentb766d584b36b78c96e9ef60ec927214c74ede4ab (diff)
downloadnitrocli-560152b074e017753517f1d3c6e4431410ebed4b.tar.gz
nitrocli-560152b074e017753517f1d3c6e4431410ebed4b.tar.bz2
Fix incomplete help text for encrypted & unencrypted subcommands
Subcommands of the encrypted and unencrypted commands were found to have a wrong help text displayed. The reason for that behavior was that the subargs were are constructing as part of the argument parsing process were missing the command being requested and instead containing only the subcommand. This change fixes this deficiency. It also adds a test ensuring that the "Usage" string displayed in the help text of each command and subcommand contains the proper arguments.
Diffstat (limited to 'nitrocli/src/tests/mod.rs')
-rw-r--r--nitrocli/src/tests/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/nitrocli/src/tests/mod.rs b/nitrocli/src/tests/mod.rs
index 2f2926f..c823f52 100644
--- a/nitrocli/src/tests/mod.rs
+++ b/nitrocli/src/tests/mod.rs
@@ -136,7 +136,7 @@ impl Nitrocli {
}
}
- fn do_run<F, R>(&mut self, args: &[&'static str], f: F) -> (R, Vec<u8>, Vec<u8>)
+ fn do_run<F, R>(&mut self, args: &[&str], f: F) -> (R, Vec<u8>, Vec<u8>)
where
F: FnOnce(&mut crate::RunCtx<'_>, Vec<String>) -> R,
{
@@ -166,12 +166,12 @@ impl Nitrocli {
}
/// Run `nitrocli`'s `run` function.
- pub fn run(&mut self, args: &[&'static str]) -> (i32, Vec<u8>, Vec<u8>) {
+ pub fn run(&mut self, args: &[&str]) -> (i32, Vec<u8>, Vec<u8>) {
self.do_run(args, |c, a| crate::run(c, a))
}
/// Run `nitrocli`'s `handle_arguments` function.
- pub fn handle(&mut self, args: &[&'static str]) -> crate::Result<String> {
+ pub fn handle(&mut self, args: &[&str]) -> crate::Result<String> {
let (res, out, _) = self.do_run(args, |c, a| crate::args::handle_arguments(c, a));
res.map(|_| String::from_utf8_lossy(&out).into_owned())
}