(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: { (SQ <'git web--browse basic tests\n'> <'\n'> <'This test checks that git web--browse can handle various valid URLs.'> ) } spids: [7] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: test_web_browse body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [ {<git>} {<web--browse>} {<--browser> <Id.Lit_Equals '='> (DQ ($ Id.VSub_Number '$1'))} {(DQ ($ Id.VSub_Number '$2'))} ] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (command.Simple words: [{<tr>} {<-d>} {(SQ <'\\015'>)}] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {<actual>} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<text>} ) ] do_fork: T ) (C {<test_cmp>} {<expect>} {<text>}) ] ) ] ) ) (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>}) ] )