tests: add wrap_help test with significant whitepace

This adds a test for the issue #617 about keeping whitespace intact in
manually aligned text.
This commit is contained in:
Martin Geisler 2017-01-29 21:38:30 +01:00 committed by Kevin K
parent 918283d645
commit 13653042c2

View file

@ -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
@ -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")