Mercurial > hg > hg-git
changeset 586:24d4741674a6
tests: use fn_git_commit in test-encoding.t
In c4849b2dab87, the "commit" function was extracted into a testutil for re-use.
However, test-encoding.t was skipped over in that changeset, as I was seeing
unexplained test failures. Since those test failures have now been explained
(and fixed), this changeset performs the same extraction on test-encoding.t as
was done on all the other tests.
The version of fn_git_commit that was used in testutil redirected all output
(including errors) to /dev/null, which didn't match the expectations of this
test. The test utility functions for commit/tag now no longer throw away error
output, instead leaving it to individual tests to decide if error output should
be ignored.
author | David M. Carr <david@carrclan.us> |
---|---|
date | Sat, 03 Nov 2012 22:36:13 -0400 |
parents | fbbdbc8a8785 |
children | 4d9e2d2a2c19 |
files | tests/latin-1-encoding tests/test-encoding.t tests/testutil |
diffstat | 3 files changed, 8 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/latin-1-encoding +++ b/tests/latin-1-encoding @@ -5,14 +5,14 @@ GIT_AUTHOR_NAME='tést èncödîng'; export GIT_AUTHOR_NAME echo beta > beta git add beta -commit -m 'add beta' +fn_git_commit -m 'add beta' echo gamma > gamma git add gamma -commit -m 'add gämmâ' +fn_git_commit -m 'add gämmâ' # test the commit encoding field git config i18n.commitencoding latin-1 echo delta > delta git add delta -commit -m 'add déltà' +fn_git_commit -m 'add déltà'
--- a/tests/test-encoding.t +++ b/tests/test-encoding.t @@ -3,22 +3,6 @@ Load commonly used test logic $ . "$TESTDIR/testutil" - $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME - $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL - $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE - $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME - $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL - $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE - - $ count=10 - $ commit() - > { - > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" - > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" - > git commit "$@" >/dev/null || echo "git commit error" - > count=`expr $count + 1` - > } - $ git init gitrepo Initialized empty Git repository in $TESTTMP/gitrepo/.git/ $ cd gitrepo @@ -26,7 +10,7 @@ utf-8 encoded commit message $ echo alpha > alpha $ git add alpha - $ commit -m 'add älphà ' + $ fn_git_commit -m 'add älphà ' Create some commits using latin1 encoding The warning message changed in Git 1.8.0
--- a/tests/testutil +++ b/tests/testutil @@ -33,25 +33,25 @@ fn_git_commit() { GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" - git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" + git commit "$@" >/dev/null || echo "git commit error" count=`expr $count + 1` } fn_hg_commit() { HGDATE="2007-01-01 00:00:$count +0000" - hg commit -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg commit error" + hg commit -d "$HGDATE" "$@" >/dev/null || echo "hg commit error" count=`expr $count + 1` } fn_git_tag() { GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" - git tag "$@" >/dev/null 2>/dev/null || echo "git tag error" + git tag "$@" >/dev/null || echo "git tag error" count=`expr $count + 1` } fn_hg_tag() { HGDATE="2007-01-01 00:00:$count +0000" - hg tag -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg tag error" + hg tag -d "$HGDATE" "$@" >/dev/null || echo "hg tag error" count=`expr $count + 1` }