Skip to content

Commit 6181b9a

Browse files
Felipe Contrerasgitster
authored andcommitted
remote-hg: add basic author tests
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent cbf6237 commit 6181b9a

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

contrib/remote-helpers/test-hg.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,39 @@ test_expect_success 'update bookmark' '
118118
hg -R hgrepo bookmarks | grep "devel\s\+3:"
119119
'
120120

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+
121156
test_done

0 commit comments

Comments
 (0)