summaryrefslogtreecommitdiff
path: root/t/t1502-rev-parse-parseopt.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-23 22:26:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-24 00:28:03 (GMT)
commitce7f8745aa773dfe2fc0a1b8c327b50c7ce4a31e (patch)
treef7d694e20c57ac74da635162d89dac6af5ffacca /t/t1502-rev-parse-parseopt.sh
parent9bab5b6061f1bc8ca54f8ac145f4f88c644e3bc4 (diff)
downloadgit-ce7f8745aa773dfe2fc0a1b8c327b50c7ce4a31e.zip
git-ce7f8745aa773dfe2fc0a1b8c327b50c7ce4a31e.tar.gz
git-ce7f8745aa773dfe2fc0a1b8c327b50c7ce4a31e.tar.bz2
t1502: protect runs of SPs used in the indentation
The expected output from the argument help use runs of SPs to align the description of each option; a careless use of --whitespace=fix can turn leading parts of them into appropriate number of HTs. Prevent such a breakage by prefixing all the expected lines with leading vertical bars in the original and stripping them with a small sed script. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1502-rev-parse-parseopt.sh')
-rwxr-xr-xt/t1502-rev-parse-parseopt.sh112
1 files changed, 56 insertions, 56 deletions
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index 960adf5..922423e 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -3,64 +3,64 @@
test_description='test git rev-parse --parseopt'
. ./test-lib.sh
-cat > expect <<\END_EXPECT
-cat <<\EOF
-usage: some-command [options] <args>...
-
- some-command does foo and bar!
-
- -h, --help show the help
- --foo some nifty option --foo
- --bar ... some cool option --bar with an argument
- -b, --baz a short and long option
-
-An option group Header
- -C[...] option C with an optional argument
- -d, --data[=...] short and long option with an optional argument
-
-Argument hints
- -b <arg> short option required argument
- --bar2 <arg> long option required argument
- -e, --fuz <with-space>
- short and long option required argument
- -s[<some>] short option optional argument
- --long[=<data>] long option optional argument
- -g, --fluf[=<path>] short and long option optional argument
- --longest <very-long-argument-hint>
- a very long argument hint
-
-Extras
- --extra1 line above used to cause a segfault but no longer does
-
-EOF
+sed -e 's/^|//' >expect <<\END_EXPECT
+|cat <<\EOF
+|usage: some-command [options] <args>...
+|
+| some-command does foo and bar!
+|
+| -h, --help show the help
+| --foo some nifty option --foo
+| --bar ... some cool option --bar with an argument
+| -b, --baz a short and long option
+|
+|An option group Header
+| -C[...] option C with an optional argument
+| -d, --data[=...] short and long option with an optional argument
+|
+|Argument hints
+| -b <arg> short option required argument
+| --bar2 <arg> long option required argument
+| -e, --fuz <with-space>
+| short and long option required argument
+| -s[<some>] short option optional argument
+| --long[=<data>] long option optional argument
+| -g, --fluf[=<path>] short and long option optional argument
+| --longest <very-long-argument-hint>
+| a very long argument hint
+|
+|Extras
+| --extra1 line above used to cause a segfault but no longer does
+|
+|EOF
END_EXPECT
-cat > optionspec << EOF
-some-command [options] <args>...
-
-some-command does foo and bar!
---
-h,help show the help
-
-foo some nifty option --foo
-bar= some cool option --bar with an argument
-b,baz a short and long option
-
- An option group Header
-C? option C with an optional argument
-d,data? short and long option with an optional argument
-
- Argument hints
-b=arg short option required argument
-bar2=arg long option required argument
-e,fuz=with-space short and long option required argument
-s?some short option optional argument
-long?data long option optional argument
-g,fluf?path short and long option optional argument
-longest=very-long-argument-hint a very long argument hint
-
-Extras
-extra1 line above used to cause a segfault but no longer does
+sed -e 's/^|//' >optionspec <<\EOF
+|some-command [options] <args>...
+|
+|some-command does foo and bar!
+|--
+|h,help show the help
+|
+|foo some nifty option --foo
+|bar= some cool option --bar with an argument
+|b,baz a short and long option
+|
+| An option group Header
+|C? option C with an optional argument
+|d,data? short and long option with an optional argument
+|
+| Argument hints
+|b=arg short option required argument
+|bar2=arg long option required argument
+|e,fuz=with-space short and long option required argument
+|s?some short option optional argument
+|long?data long option optional argument
+|g,fluf?path short and long option optional argument
+|longest=very-long-argument-hint a very long argument hint
+|
+|Extras
+|extra1 line above used to cause a segfault but no longer does
EOF
test_expect_success 'test --parseopt help output' '