#!/bin/sh global test_description := ''help'' source ./test-lib.sh proc configure_help { test_config help.format html && # Unless the path has "://" in it, Git tries to make sure # the documentation directory locally exists. Avoid it as # we are only interested in seeing an attempt to correctly # invoke a help browser in this test. test_config help.htmlpath test://html && # Name a custom browser test_config browser.test.cmd ./test-browser && test_config help.browser test } test_expect_success "setup" ' # Just write out which page gets requested write_script test-browser <<-\EOF echo "$*" >test-browser.log EOF ' test_expect_success "works for commands and guides by default" ' configure_help && git help status && echo "test://html/git-status.html" >expect && test_cmp expect test-browser.log && git help revisions && echo "test://html/gitrevisions.html" >expect && test_cmp expect test-browser.log ' test_expect_success "--exclude-guides does not work for guides" ' >test-browser.log && test_must_fail git help --exclude-guides revisions && test_must_be_empty test-browser.log ' test_expect_success "--help does not work for guides" " cat <<-EOF >expect && git: 'revisions' is not a git command. See 'git --help'. EOF test_must_fail git revisions --help 2>actual && test_i18ncmp expect actual " test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:test_description) op:Equal rhs:{(SQ )} spids:[4])] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: configure_help body: (BraceGroup children: [ (AndOr children: [ (C {(test_config)} {(help.format)} {(html)}) (AndOr children: [ (C {(test_config)} {(help.htmlpath)} {(test) (Lit_Other ":") (//html)}) (AndOr children: [ (C {(test_config)} {(browser.test.cmd)} {(./test-browser)}) (C {(test_config)} {(help.browser)} {(test)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [20] ) spids: [15 19] ) (C {(test_expect_success)} {(DQ (setup))} { (SQ <"\n"> <"\t# Just write out which page gets requested\n"> <"\twrite_script test-browser <<-\\EOF\n"> <"\techo \"$*\" >test-browser.log\n"> <"\tEOF\n"> ) } ) (C {(test_expect_success)} {(DQ ("works for commands and guides by default"))} { (SQ <"\n"> <"\tconfigure_help &&\n"> <"\tgit help status &&\n"> <"\techo \"test://html/git-status.html\" >expect &&\n"> <"\ttest_cmp expect test-browser.log &&\n"> <"\tgit help revisions &&\n"> <"\techo \"test://html/gitrevisions.html\" >expect &&\n"> <"\ttest_cmp expect test-browser.log\n"> ) } ) (C {(test_expect_success)} {(DQ ("--exclude-guides does not work for guides"))} { (SQ <"\n"> <"\t>test-browser.log &&\n"> <"\ttest_must_fail git help --exclude-guides revisions &&\n"> <"\ttest_must_be_empty test-browser.log\n"> ) } ) (C {(test_expect_success)} {(DQ ("--help does not work for guides"))} { (DQ ("\n") ("\tcat <<-EOF >expect &&\n") ("\t\tgit: 'revisions' is not a git command. See 'git --help'.\n") ("\tEOF\n") ("\ttest_must_fail git revisions --help 2>actual &&\n") ("\ttest_i18ncmp expect actual\n") ) } ) (C {(test_done)}) ] )