Skip to content

Commit 6181b9a

Browse files
felipecgitster
authored andcommitted
remote-hg: add basic author tests
Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cbf6237 commit 6181b9a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

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 <[email protected]>" &&
139+
author_test beta "test" "test <unknown>" &&
140+
author_test beta "test <[email protected]> (comment)" "test <unknown>" &&
141+
author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
142+
author_test delta "name<[email protected]>" "name <[email protected]>" &&
143+
author_test epsilon "name <[email protected]" "name <unknown>" &&
144+
author_test zeta " test " "test <unknown>" &&
145+
author_test eta "test < [email protected] >" "test <[email protected]>" &&
146+
author_test theta "test >[email protected]>" "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)