(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description spids:[15]) op: Equal rhs: { (SQ <'git web--browse basic tests\n'> <'\n'> <'This test checks that git web--browse can handle various valid URLs.'> ) } spids: [15] ) ] spids: [15] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: test_web_browse body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (command.SimpleCommand words: [ {(git)} {(web--browse)} {(--browser) (Lit_Other '=') (DQ ($ VSub_Number '$1'))} {(DQ ($ VSub_Number '$2'))} ] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(actual)})] ) (command.SimpleCommand words: [{(tr)} {(-d)} {(SQ <'\\015'>)}] redirects: [ (redir.Redir op: <Redir_Less '<'> fd: 16777215 arg_word: {(actual)} ) (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(text)} ) ] ) (C {(test_cmp)} {(expect)} {(text)}) ] ) ] spids: [33] ) spids: [28 32] ) (C {(test_expect_success)} {(SQ <'URL with an ampersand in it'>)} { (SQ <'\n'> <'\techo http://example.com/foo\\&bar >expect &&\n'> <'\tgit config browser.custom.cmd echo &&\n'> <'\ttest_web_browse custom http://example.com/foo\\&bar\n'> ) } ) (C {(test_expect_success)} {(SQ <'URL with a semi-colon in it'>)} { (SQ <'\n'> <'\techo http://example.com/foo\\;bar >expect &&\n'> <'\tgit config browser.custom.cmd echo &&\n'> <'\ttest_web_browse custom http://example.com/foo\\;bar\n'> ) } ) (C {(test_expect_success)} {(SQ <'URL with a hash in it'>)} { (SQ <'\n'> <'\techo http://example.com/foo#bar >expect &&\n'> <'\tgit config browser.custom.cmd echo &&\n'> <'\ttest_web_browse custom http://example.com/foo#bar\n'> ) } ) (C {(test_expect_success)} {(SQ <'browser paths are properly quoted'>)} { (SQ <'\n'> <'\techo fake: http://example.com/foo >expect &&\n'> <'\tcat >"fake browser" <<-\\EOF &&\n'> <'\t#!/bin/sh\n'> <'\techo fake: "$@"\n'> <'\tEOF\n'> <'\tchmod +x "fake browser" &&\n'> <'\tgit config browser.w3m.path "$(pwd)/fake browser" &&\n'> <'\ttest_web_browse w3m http://example.com/foo\n'> ) } ) (C {(test_expect_success)} {(SQ <'browser command allows arbitrary shell code'>)} { (SQ <'\n'> <'\techo "arg: http://example.com/foo" >expect &&\n'> <'\tgit config browser.custom.cmd "\n'> <'\t\tf() {\n'> <'\t\t\tfor i in \\"\\$@\\"; do\n'> <'\t\t\t\techo arg: \\$i\n'> <'\t\t\tdone\n'> <'\t\t}\n'> <'\t\tf" &&\n'> <'\ttest_web_browse custom http://example.com/foo\n'> ) } ) (C {(test_done)}) ] )