diff options
author | David Paleino <dapal@debian.org> | 2011-01-09 18:19:18 +0100 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2011-01-09 18:19:18 +0100 |
commit | a5e203cfe5bc335667900a3026a13e613152b50c (patch) | |
tree | cbc49be2e8062a929ddb2cfc56e15adfdcab2c49 /test/unit/_parse_help.exp | |
parent | bccf24e53240356343eb48c00cd256fb7ad2a39a (diff) | |
parent | fe2d7645df9f619a33feb8c8d7c89b1ea5fcad6b (diff) | |
download | bash-completion-a5e203cfe5bc335667900a3026a13e613152b50c.tar.gz |
Merge branch 'master' into 1.x
Conflicts:
CHANGES
configure.ac
Diffstat (limited to 'test/unit/_parse_help.exp')
-rw-r--r-- | test/unit/_parse_help.exp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp new file mode 100644 index 00000000..4beb28d2 --- /dev/null +++ b/test/unit/_parse_help.exp @@ -0,0 +1,73 @@ +# By Stephen Gildea, October 2010. + +proc setup {} { + save_env +} + +proc teardown {} { + assert_env_unmodified { + /declare -f fn/d + } +} + +setup + + +set cmd {fn() { printf '%s\n' ""; }; _parse_help fn} +assert_bash_list "" $cmd "empty" +sync_after_int + +set cmd {fn() { printf '%s\n' "no dashes here"; }; _parse_help fn} +assert_bash_list "" $cmd "no dashes" +sync_after_int + +set cmd {fn() { printf '%s\n' "internal-dash"; }; _parse_help fn} +assert_bash_list "" $cmd "internal dash 1" +sync_after_int + +set cmd {fn() { printf '%s\n' "no -leading-dashes"; }; _parse_help fn} +assert_bash_list "" $cmd "no leading dash" +sync_after_int + +set cmd {fn() { printf '%s\n' "-one dash"; }; _parse_help fn} +assert_bash_list "-one" $cmd "one dash" +sync_after_int + +set cmd {fn() { printf '%s\n' " -space dash"; }; _parse_help fn} +assert_bash_list "-space" $cmd "one dash after space" +sync_after_int + +set cmd {fn() { printf '%s\n' "-one -two dashes"; }; _parse_help fn} +assert_bash_list "-one\n-two" $cmd "two dashes, space-separated" +sync_after_int + +set cmd {fn() { printf '%s\n' "-one,-t dashes"; }; _parse_help fn} +assert_bash_list "-one\n-t" $cmd "two dashes, comma-separated" +sync_after_int + +set cmd {fn() { printf '%s\n' "-one dash-inside"; }; _parse_help fn} +assert_bash_list "-one" $cmd "internal dash 2" +sync_after_int + +set cmd {fn() { printf '%s\n' "--long-arg=value"; }; _parse_help fn} +assert_bash_list "--long-arg" $cmd "value stripped" +sync_after_int + +set cmd {fn() { printf '%s\n' "--long-arg=-value"; }; _parse_help fn} +assert_bash_list "--long-arg" $cmd "value not seen as option" +sync_after_int + +set cmd {fn() { printf '%s\n' "--long-arg=-value,--opt2=val"; }; _parse_help fn} +assert_bash_list "--long-arg\n--opt2" $cmd "two options with values" +sync_after_int + +set cmd {fn() { printf '%s\n' "-m,--mirror"; }; _parse_help fn} +assert_bash_list "-m\n--mirror" $cmd "short + long" +sync_after_int + +set cmd {fn() { printf '%s\n' "-T/--upload-file"; }; _parse_help fn} +assert_bash_list "-T\n--upload-file" $cmd "short + long, slash separated" +sync_after_int + + +teardown |