This repository was archived by the owner on May 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from kbknapp/make-tests-pass
tests: Make tests pass
- Loading branch information
Showing
13 changed files
with
159 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ use clap::Clap; | |
|
||
#[test] | ||
fn no_author_version_about() { | ||
use clap::IntoApp; | ||
|
||
#[derive(Clap, PartialEq, Debug)] | ||
#[clap(name = "foo", about = "", author = "", version = "")] | ||
struct Opt {} | ||
|
@@ -30,16 +32,31 @@ fn no_author_version_about() { | |
assert!(output.starts_with("foo \n\nUSAGE:")); | ||
} | ||
|
||
static ENV_HELP: &str = "clap_derive 0.3.0 | ||
Guillaume Pinot <[email protected]>, Kevin K. <[email protected]>, hoverbear <[email protected]> | ||
Parse command line argument by defining a struct, derive crate. | ||
USAGE: | ||
clap_derive | ||
FLAGS: | ||
-h, --help | ||
Prints help information | ||
-V, --version | ||
Prints version information | ||
"; | ||
|
||
#[test] | ||
fn use_env() { | ||
use clap::IntoApp; | ||
|
||
#[derive(Clap, PartialEq, Debug)] | ||
#[clap()] | ||
struct Opt {} | ||
|
||
let mut output = Vec::new(); | ||
Opt::into_app().write_long_help(&mut output).unwrap(); | ||
let output = String::from_utf8(output).unwrap(); | ||
assert!(output.starts_with("structopt 0.2.")); | ||
assert!(output.contains("Guillaume Pinot <[email protected]>, others")); | ||
assert!(output.contains("Parse command line argument by defining a struct.")); | ||
assert_eq!(output, ENV_HELP); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.