Skip to content

Commit

Permalink
fix: avoid panic generating default help msg if term width set to 0 d…
Browse files Browse the repository at this point in the history
…ue to bug in textwrap 0.7.0

upgrade textwrap to 0.8.0 and add regression test
  • Loading branch information
Fraser999 committed Sep 6, 2017
1 parent f2266e2 commit b3eadb0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ appveyor = { repository = "kbknapp/clap-rs" }
bitflags = "0.9"
vec_map = "0.8"
unicode-width = "0.1.4"
unicode-segmentation = "1.2.0"
textwrap = "0.7.0"
unicode-segmentation = "1.2.0"
textwrap = "0.8.0"
strsim = { version = "0.6.0", optional = true }
ansi_term = { version = "0.9.0", optional = true }
term_size = { version = "0.3.0", optional = true }
Expand Down
15 changes: 15 additions & 0 deletions tests/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,15 @@ ARGS:
<FIRST>... First
<SECOND>... Second";

static DEFAULT_HELP: &'static str = "ctest
USAGE:
ctest
FLAGS:
-h, --help Prints help information
-V, --version Prints version information";

#[test]
fn help_short() {
let m = App::new("test")
Expand Down Expand Up @@ -592,6 +601,12 @@ fn no_wrap_help() {
assert!(test::compare_output(app, "ctest --help", MULTI_SC_HELP, false));
}

#[test]
fn no_wrap_default_help() {
let app = App::new("ctest").set_term_width(0);
assert!(test::compare_output(app, "ctest --help", DEFAULT_HELP, false));
}

#[test]
fn complex_subcommand_help_output() {
let a = test::complex_app();
Expand Down

0 comments on commit b3eadb0

Please sign in to comment.