clap/tests
Martin Geisler b93870c10a feat: use textwrap crate for wrapping help texts
The textwrap crate uses a simpler linear-time algorithm for wrapping
the text. The current algorithm in wrap_help uses several O(n) calls
to String::insert and String::remove, which makes it potentially
quadratic in complexity.

Comparing the 05_ripgrep benchmark at commits textwrap~2 and textwrap
gives this result on my machine:

 name              before ns/iter  after ns/iter  diff ns/iter   diff %
 build_app_long    22,101          21,099               -1,002   -4.53%
 build_app_short   22,138          21,205                 -933   -4.21%
 build_help_long   514,265         284,467            -229,798  -44.68%
 build_help_short  85,720          85,693                  -27   -0.03%
 parse_clean       23,471          22,859                 -612   -2.61%
 parse_complex     29,535          28,919                 -616   -2.09%
 parse_lots        422,815         414,577              -8,238   -1.95%

As part of this commit, the wrapping_newline_chars test was updated.
The old algorithm had a subtle bug where it would break lines too
early. That is, it wrapped the text like

    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.";

when it should really have wrapped it like

    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.";

Notice how the word "14" was incorrectly moved to the next line. There
is clearly room for the word on the line with the "l, long" option
since there is room for "contains" just above it.

I'm not sure why this is, but the algorithm in textwrap handles this
case correctly.
2017-05-29 17:02:57 -04:00
..
app.yml Support loading help_message and version_message from the YAML 2017-03-10 01:54:50 -05:00
app_settings.rs api(App::name): adds the ability to change the name of the App instance after creation 2017-03-22 20:27:20 -04:00
arg_aliases.rs tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
borrowed.rs tests: adds tests to ensure borrowed args don't break 2017-02-28 08:30:14 -05:00
completions.rs imp: add fish subcommand help support 2017-03-17 17:46:24 +01:00
conflicts.rs tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
default_vals.rs api(Arg): add default_value_os 2017-04-24 15:49:59 -04:00
delimiters.rs fix: fixes a bug where flags were parsed as flags AND positional values when specific combinations of settings were used 2017-05-07 10:46:03 -04:00
derive_order.rs tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
example1_tmpl_full.txt feat(HELP): Add a Templated Help system. 2016-04-13 07:06:23 -03:00
example1_tmpl_simple.txt feat(HELP): Add a Templated Help system. 2016-04-13 07:06:23 -03:00
flags.rs refactor(Arg): removes duplicate and uses Base, Switched, and Valued internally now 2017-02-20 19:06:36 -05:00
groups.rs tests: adds a test where a non-existing arg is added to a group to ensure a failed debug assertion 2017-05-16 07:23:22 -04:00
help.rs feat: use textwrap crate for wrapping help texts 2017-05-29 17:02:57 -04:00
hidden_args.rs tests: fixes failing hidden args test 2017-03-10 08:24:30 -05:00
macros.rs tests(clap_app!): adds tests for ("config-file") style positonal args 2017-04-05 00:57:40 -04:00
multiple_occurrences.rs tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
multiple_values.rs tests: adds tests to guard against low index multiples with allow_hyphen_values failing 2017-01-02 14:34:25 -05:00
opts.rs tests: adds tests for using double hyphen -- as a value 2017-05-16 07:23:22 -04:00
positionals.rs tests: adds tests to ensure flags not incorrectly parsed as positionals 2017-05-07 10:46:03 -04:00
posix_compatible.rs tests: adds tests for different value delimiters 2016-01-28 11:45:31 -05:00
possible_values.rs tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
require.rs tests: adds tests for reqire_equals(true) errors and help 2017-03-16 21:45:45 -04:00
subcommands.rs tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
template_help.rs tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
tests.rs tests: massively rehauls tests for better debugging and vastly improved error messages/deduplication 2017-01-02 23:05:50 -05:00
unique_args.rs perf: refactor to remove unneeded vectors and allocations and checks for significant performance increases 2017-02-28 08:30:13 -05:00
utf8.rs chore: fixes doc and style mistakes 2016-01-28 21:58:40 -05:00
version.rs tests: adds tests to verify help and version can be properly overridden 2017-04-04 19:56:34 -04:00
yaml.rs fix(yaml): adds support for loading author info from yaml 2017-03-22 20:23:55 -04:00