remote-hg: add basic author tests

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Apr 11, 2013 at 07:23 UTC 6181b9a63ceccce9aff29b14f3872f2c3d187d45
1 file changed +35
contrib/remote-helpers/test-hg.sh
+35
@@ -118,4 +118,39 @@ test_expect_success 'update bookmark' '
118 hg -R hgrepo bookmarks | grep "devel\s\+3:"
119 '
120
121 +author_test () {
122 + echo $1 >> content &&
123 + hg commit -u "$2" -m "add $1" &&
124 + echo "$3" >> ../expected
125 +}
126 +
127 +test_expect_success 'authors' '
128 + mkdir -p tmp && cd tmp &&
129 + test_when_finished "cd .. && rm -rf tmp" &&
130 +
131 + (
132 + hg init hgrepo &&
133 + cd hgrepo &&
134 +
135 + touch content &&
136 + hg add content &&
137 +
138 + author_test alpha "" "H G Wells <wells@example.com>" &&
139 + author_test beta "test" "test <unknown>" &&
140 + author_test beta "test <test@example.com> (comment)" "test <unknown>" &&
141 + author_test gamma "<test@example.com>" "Unknown <test@example.com>" &&
142 + author_test delta "name<test@example.com>" "name <test@example.com>" &&
143 + author_test epsilon "name <test@example.com" "name <unknown>" &&
144 + author_test zeta " test " "test <unknown>" &&
145 + author_test eta "test < test@example.com >" "test <test@example.com>" &&
146 + author_test theta "test >test@example.com>" "test <unknown>" &&
147 + author_test iota "test < test <at> example <dot> com>" "test <unknown>"
148 + ) &&
149 +
150 + git clone "hg::$PWD/hgrepo" gitrepo &&
151 + git --git-dir=gitrepo/.git log --reverse --format="%an <%ae>" > actual &&
152 +
153 + test_cmp expected actual
154 +'
155 +
156 test_done