(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"test git rev-parse --parseopt">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <"setup optionspec">)} { (SQ <"\n"> <"\tsed -e \"s/^|//\" >optionspec <<\\EOF\n"> <"|some-command [options] <args>...\n"> <"|\n"> <"|some-command does foo and bar!\n"> <"|--\n"> <"|h,help show the help\n"> <"|\n"> <"|foo some nifty option --foo\n"> <"|bar= some cool option --bar with an argument\n"> <"|b,baz a short and long option\n"> <"|\n"> <"| An option group Header\n"> <"|C? option C with an optional argument\n"> <"|d,data? short and long option with an optional argument\n"> <"|\n"> <"| Argument hints\n"> <"|B=arg short option required argument\n"> <"|bar2=arg long option required argument\n"> <"|e,fuz=with-space short and long option required argument\n"> <"|s?some short option optional argument\n"> <"|long?data long option optional argument\n"> <"|g,fluf?path short and long option optional argument\n"> <"|longest=very-long-argument-hint a very long argument hint\n"> <"|pair=key=value with an equals sign in the hint\n"> <"|short-hint=a with a one symbol hint\n"> <"|\n"> <"|Extras\n"> <"|extra1 line above used to cause a segfault but no longer does\n"> <"EOF\n"> ) } ) (C {(test_expect_success)} {(SQ <"test --parseopt help output">)} { (SQ <"\n"> <"\tsed -e \"s/^|//\" >expect <<\\END_EXPECT &&\n"> <"|cat <<\\EOF\n"> <"|usage: some-command [options] <args>...\n"> <"|\n"> <"| some-command does foo and bar!\n"> <"|\n"> <"| -h, --help show the help\n"> <"| --foo some nifty option --foo\n"> <"| --bar ... some cool option --bar with an argument\n"> <"| -b, --baz a short and long option\n"> <"|\n"> <"|An option group Header\n"> <"| -C[...] option C with an optional argument\n"> <"| -d, --data[=...] short and long option with an optional argument\n"> <"|\n"> <"|Argument hints\n"> <"| -B <arg> short option required argument\n"> <"| --bar2 <arg> long option required argument\n"> <"| -e, --fuz <with-space>\n"> <"| short and long option required argument\n"> <"| -s[<some>] short option optional argument\n"> <"| --long[=<data>] long option optional argument\n"> <"| -g, --fluf[=<path>] short and long option optional argument\n"> <"| --longest <very-long-argument-hint>\n"> <"| a very long argument hint\n"> <"| --pair <key=value> with an equals sign in the hint\n"> <"| --short-hint <a> with a one symbol hint\n"> <"|\n"> <"|Extras\n"> <"| --extra1 line above used to cause a segfault but no longer does\n"> <"|\n"> <"|EOF\n"> <"END_EXPECT\n"> <"\ttest_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec &&\n"> <"\ttest_i18ncmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup expect.1">)} {(DQ ("\n") ("\tcat > expect <<EOF\n") ("set -- --foo --bar 'ham' -b -- 'arg'\n") ("EOF\n"))} ) (C {(test_expect_success)} {(SQ <"test --parseopt">)} { (SQ <"\n"> <"\tgit rev-parse --parseopt -- --foo --bar=ham --baz arg < optionspec > output &&\n"> <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"test --parseopt with mixed options and arguments">)} { (SQ <"\n"> <"\tgit rev-parse --parseopt -- --foo arg --bar=ham --baz < optionspec > output &&\n"> <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup expect.2">)} {(DQ ("\n") ("\tcat > expect <<EOF\n") ("set -- --foo -- 'arg' '--bar=ham'\n") ("EOF\n"))} ) (C {(test_expect_success)} {(SQ <"test --parseopt with --">)} { (SQ <"\n"> <"\tgit rev-parse --parseopt -- --foo -- arg --bar=ham < optionspec > output &&\n"> <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"test --parseopt --stop-at-non-option">)} { (SQ <"\n"> < "\tgit rev-parse --parseopt --stop-at-non-option -- --foo arg --bar=ham < optionspec > output &&\n" > <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup expect.3">)} {(DQ ("\n") ("\tcat > expect <<EOF\n") ("set -- --foo -- '--' 'arg' '--bar=ham'\n") ("EOF\n"))} ) (C {(test_expect_success)} {(SQ <"test --parseopt --keep-dashdash">)} { (SQ <"\n"> < "\tgit rev-parse --parseopt --keep-dashdash -- --foo -- arg --bar=ham < optionspec > output &&\n" > <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup expect.4">)} {(DQ ("\n") ("\tcat >expect <<EOF\n") ("set -- --foo -- '--' 'arg' '--spam=ham'\n") ("EOF\n"))} ) (C {(test_expect_success)} {(SQ <"test --parseopt --keep-dashdash --stop-at-non-option with --">)} { (SQ <"\n"> < "\tgit rev-parse --parseopt --keep-dashdash --stop-at-non-option -- --foo -- arg --spam=ham <optionspec >output &&\n" > <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup expect.5">)} {(DQ ("\n") ("\tcat > expect <<EOF\n") ("set -- --foo -- 'arg' '--spam=ham'\n") ("EOF\n"))} ) (C {(test_expect_success)} {(SQ <"test --parseopt --keep-dashdash --stop-at-non-option without --">)} { (SQ <"\n"> < "\tgit rev-parse --parseopt --keep-dashdash --stop-at-non-option -- --foo arg --spam=ham <optionspec >output &&\n" > <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup expect.6">)} { (DQ ("\n") ("\tcat > expect <<EOF\n") ("set -- --foo --bar='z' --baz -C'Z' --data='A' -- 'arg'\n") ("EOF\n") ) } ) (C {(test_expect_success)} {(SQ <"test --parseopt --stuck-long">)} { (SQ <"\n"> < "\tgit rev-parse --parseopt --stuck-long -- --foo --bar=z -b arg -CZ -dA <optionspec >output &&\n" > <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup expect.7">)} {(DQ ("\n") ("\tcat > expect <<EOF\n") ("set -- --data='' -C --baz -- 'arg'\n") ("EOF\n"))} ) (C {(test_expect_success)} {(SQ <"test --parseopt --stuck-long and empty optional argument">)} { (SQ <"\n"> <"\tgit rev-parse --parseopt --stuck-long -- --data= arg -C -b <optionspec >output &&\n"> <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup expect.8">)} {(DQ ("\n") ("\tcat > expect <<EOF\n") ("set -- --data --baz -- 'arg'\n") ("EOF\n"))} ) (C {(test_expect_success)} {(SQ <"test --parseopt --stuck-long and long option with unset optional argument">)} { (SQ <"\n"> <"\tgit rev-parse --parseopt --stuck-long -- --data arg -b <optionspec >output &&\n"> <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"test --parseopt --stuck-long and short option with unset optional argument">)} { (SQ <"\n"> <"\tgit rev-parse --parseopt --stuck-long -- -d arg -b <optionspec >output &&\n"> <"\ttest_cmp expect output\n"> ) } ) (C {(test_done)}) ] )