submodule: Use cat instead of echo to avoid DOS line-endings
[git/dscho.git] / t / t9901-git-web--browse.sh
blob7906e5d0320bc65807e9d434cc3c82b16df30ea9
1 #!/bin/sh
4 test_description='git web--browse basic tests
6 This test checks that git web--browse can handle various valid URLs.'
8 . ./test-lib.sh
10 test_expect_success \
11 'URL with an ampersand in it' '
12 echo http://example.com/foo\&bar >expect &&
13 git config browser.custom.cmd echo &&
14 git web--browse --browser=custom \
15 http://example.com/foo\&bar >actual &&
16 test_cmp expect actual
19 test_expect_success \
20 'URL with a semi-colon in it' '
21 echo http://example.com/foo\;bar >expect &&
22 git config browser.custom.cmd echo &&
23 git web--browse --browser=custom \
24 http://example.com/foo\;bar >actual &&
25 test_cmp expect actual
28 test_expect_success \
29 'URL with a hash in it' '
30 echo http://example.com/foo#bar >expect &&
31 git config browser.custom.cmd echo &&
32 git web--browse --browser=custom \
33 http://example.com/foo#bar >actual &&
34 test_cmp expect actual
37 test_expect_success \
38 'browser paths are properly quoted' '
39 echo fake: http://example.com/foo >expect &&
40 cat >"fake browser" <<-\EOF &&
41 #!/bin/sh
42 echo fake: "$@"
43 EOF
44 chmod +x "fake browser" &&
45 git config browser.w3m.path "`pwd`/fake browser" &&
46 git web--browse --browser=w3m \
47 http://example.com/foo >actual &&
48 test_cmp expect actual
51 test_expect_success \
52 'browser command allows arbitrary shell code' '
53 echo "arg: http://example.com/foo" >expect &&
54 git config browser.custom.cmd "
55 f() {
56 for i in \"\$@\"; do
57 echo arg: \$i
58 done
60 f" &&
61 git web--browse --browser=custom \
62 http://example.com/foo >actual &&
63 test_cmp expect actual
66 test_done