Commits

David Carr committed 24d4741

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.

  • Participants
  • Parent commits fbbdbc8

Comments (0)

Files changed (3)

tests/latin-1-encoding

 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ŕ'

tests/test-encoding.t

 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
 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
 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`
 }