aboutsummaryrefslogtreecommitdiff
path: root/clap/tests/borrowed.rs
diff options
context:
space:
mode:
Diffstat (limited to 'clap/tests/borrowed.rs')
-rw-r--r--clap/tests/borrowed.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/clap/tests/borrowed.rs b/clap/tests/borrowed.rs
new file mode 100644
index 0000000..e7a184b
--- /dev/null
+++ b/clap/tests/borrowed.rs
@@ -0,0 +1,19 @@
+extern crate clap;
+extern crate regex;
+
+use clap::{App, Arg, SubCommand};
+
+include!("../clap-test.rs");
+
+#[test]
+fn borrowed_args() {
+ let arg = Arg::with_name("some").short("s").long("some").help("other help");
+ let arg2 = Arg::with_name("some2").short("S").long("some-thing").help("other help");
+ let result = App::new("sub_command_negate")
+ .arg(Arg::with_name("test").index(1))
+ .arg(&arg)
+ .arg(&arg2)
+ .subcommand(SubCommand::with_name("sub1").arg(&arg))
+ .get_matches_from_safe(vec!["prog"]);
+ assert!(result.is_ok());
+}