From 6181b9a63ceccce9aff29b14f3872f2c3d187d45 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 11 Apr 2013 07:23:11 -0500 Subject: [PATCH] remote-hg: add basic author tests Signed-off-by: Felipe Contreras Signed-off-by: Junio C Hamano --- contrib/remote-helpers/test-hg.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh index 5f81dfae6c..62e3a473bd 100755 --- a/contrib/remote-helpers/test-hg.sh +++ b/contrib/remote-helpers/test-hg.sh @@ -118,4 +118,39 @@ test_expect_success 'update bookmark' ' hg -R hgrepo bookmarks | grep "devel\s\+3:" ' +author_test () { + echo $1 >> content && + hg commit -u "$2" -m "add $1" && + echo "$3" >> ../expected +} + +test_expect_success 'authors' ' + mkdir -p tmp && cd tmp && + test_when_finished "cd .. && rm -rf tmp" && + + ( + hg init hgrepo && + cd hgrepo && + + touch content && + hg add content && + + author_test alpha "" "H G Wells " && + author_test beta "test" "test " && + author_test beta "test (comment)" "test " && + author_test gamma "" "Unknown " && + author_test delta "name" "name " && + author_test epsilon "name " && + author_test zeta " test " "test " && + author_test eta "test < test@example.com >" "test " && + author_test theta "test >test@example.com>" "test " && + author_test iota "test < test example com>" "test " + ) && + + git clone "hg::$PWD/hgrepo" gitrepo && + git --git-dir=gitrepo/.git log --reverse --format="%an <%ae>" > actual && + + test_cmp expected actual +' + test_done -- 2.11.4.GIT