]>
git.proxmox.com Git - rustc.git/blob - vendor/structopt/tests/author_version_about.rs
1 // Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>
3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6 // option. This file may not be copied, modified, or distributed
7 // except according to those terms.
11 use structopt
::StructOpt
;
15 fn no_author_version_about() {
16 #[derive(StructOpt, PartialEq, Debug)]
17 #[structopt(name = "foo", no_version)]
20 let output
= get_long_help
::<Opt
>();
21 assert
!(output
.starts_with("foo \n\nUSAGE:"));
26 #[derive(StructOpt, PartialEq, Debug)]
27 #[structopt(author, about)]
30 let output
= get_long_help
::<Opt
>();
31 assert
!(output
.starts_with("structopt 0."));
32 assert
!(output
.contains("Guillaume Pinot <texitoi@texitoi.eu>, others"));
33 assert
!(output
.contains("Parse command line argument by defining a struct."));
37 fn explicit_version_not_str() {
38 const VERSION
: &str = "custom version";
41 #[structopt(version = VERSION)]
44 let output
= get_long_help
::<Opt
>();
45 assert
!(output
.contains("custom version"));
49 fn no_version_gets_propagated() {
50 #[derive(StructOpt, PartialEq, Debug)]
51 #[structopt(no_version)]
56 let output
= get_subcommand_long_help
::<Action
>("move");
57 assert_eq
!(output
.lines().next(), Some("test-move "));