Skip to content

Commit

Permalink
tests: add wrap_help test with significant whitepace
Browse files Browse the repository at this point in the history
This adds a test for the issue #617 about keeping whitespace intact in
manually aligned text.
  • Loading branch information
mgeisler authored and kbknapp committed May 29, 2017
1 parent 918283d commit 1365304
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,22 @@ FLAGS:
(Defaults to something)
-V, --version Prints version information";

static WRAPPING_NEWLINE_CHARS: &'static str = "ctest 0.1
USAGE:
ctest [mode]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
ARGS:
<mode> x, max, maximum 20 characters, contains
symbols.
l, long Copy-friendly,
14 characters, contains symbols.
m, med, medium Copy-friendly, 8
characters, contains symbols.";

static ISSUE_688: &'static str = "ctest 0.1
Expand Down Expand Up @@ -663,6 +679,18 @@ fn final_word_wrapping() {
assert!(test::compare_output(app, "ctest --help", FINAL_WORD_WRAPPING, false));
}

#[test]
fn wrapping_newline_chars() {
let app = App::new("ctest")
.version("0.1")
.set_term_width(60)
.arg(Arg::with_name("mode")
.help("x, max, maximum 20 characters, contains symbols.{n}\
l, long Copy-friendly, 14 characters, contains symbols.{n}\
m, med, medium Copy-friendly, 8 characters, contains symbols.{n}"));
assert!(test::compare_output(app, "ctest --help", WRAPPING_NEWLINE_CHARS, false));
}

#[test]
fn old_newline_chars() {
let app = App::new("ctest")
Expand Down

0 comments on commit 1365304

Please sign in to comment.