git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGit PATCH 5/5] Use test_cmp instead of diff -u in the test suite
Date: Thu, 17 Apr 2008 23:13:10 +0200	[thread overview]
Message-ID: <20080417211310.12809.2112.stgit@yoghurt> (raw)
In-Reply-To: <20080417210137.12809.88457.stgit@yoghurt>

Since diff -u isn't available everywhere, and the user might want to
use something else.

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 t/t0002-status.sh        |   32 ++++++++++++++++----------------
 t/t1201-pull-trailing.sh |    2 +-
 t/t2700-refresh.sh       |   12 ++++++------
 t/t2800-goto-subdir.sh   |    8 ++++----
 4 files changed, 27 insertions(+), 27 deletions(-)


diff --git a/t/t0002-status.sh b/t/t0002-status.sh
index 0a70f15..4364709 100755
--- a/t/t0002-status.sh
+++ b/t/t0002-status.sh
@@ -20,7 +20,7 @@ cat > expected.txt <<EOF
 EOF
 test_expect_success 'Run status on empty' '
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -29,7 +29,7 @@ EOF
 test_expect_success 'Status with an untracked file' '
     touch foo &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 rm -f foo
 
@@ -38,7 +38,7 @@ EOF
 test_expect_success 'Status with an empty directory' '
     mkdir foo &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -47,7 +47,7 @@ EOF
 test_expect_success 'Status with an untracked file in a subdir' '
     touch foo/bar &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -56,7 +56,7 @@ EOF
 test_expect_success 'Status with an added file' '
     git add foo &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -64,7 +64,7 @@ foo/bar
 EOF
 test_expect_success 'Status with an added file and -n option' '
     stg status -n > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -73,7 +73,7 @@ test_expect_success 'Status after refresh' '
     stg new -m "first patch" &&
     stg refresh &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -82,7 +82,7 @@ EOF
 test_expect_success 'Status after modification' '
     echo "wee" >> foo/bar &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -90,7 +90,7 @@ EOF
 test_expect_success 'Status after refresh' '
     stg new -m "second patch" && stg refresh &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 test_expect_success 'Add another file' '
@@ -116,7 +116,7 @@ EOF
 test_expect_success 'Status after conflicting push' '
     ! stg push &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -124,7 +124,7 @@ C foo/bar
 EOF
 test_expect_success 'Status of file' '
     stg status foo/bar > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -132,7 +132,7 @@ C foo/bar
 EOF
 test_expect_success 'Status of dir' '
     stg status foo > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -140,7 +140,7 @@ A fie
 EOF
 test_expect_success 'Status of other file' '
     stg status fie > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -150,7 +150,7 @@ EOF
 test_expect_success 'Status after resolving the push' '
     stg resolved -a &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -160,7 +160,7 @@ EOF
 test_expect_success 'Status after deleting a file' '
     rm foo/bar &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 cat > expected.txt <<EOF
@@ -172,7 +172,7 @@ test_expect_success 'Status of disappeared newborn' '
     git add foo/bar &&
     rm foo/bar &&
     stg status > output.txt &&
-    diff -u expected.txt output.txt
+    test_cmp expected.txt output.txt
 '
 
 test_done
diff --git a/t/t1201-pull-trailing.sh b/t/t1201-pull-trailing.sh
index 46d9f82..9d70fe0 100755
--- a/t/t1201-pull-trailing.sh
+++ b/t/t1201-pull-trailing.sh
@@ -55,7 +55,7 @@ test_expect_success \
 
 test_expect_success \
     'Check that all went well' \
-    "diff -u foo/file bar/file
+    "test_cmp foo/file bar/file
 "
 
 test_done
diff --git a/t/t2700-refresh.sh b/t/t2700-refresh.sh
index 9eae85d..3759d0e 100755
--- a/t/t2700-refresh.sh
+++ b/t/t2700-refresh.sh
@@ -33,7 +33,7 @@ test_expect_success 'Refresh top patch' '
     stg status &&
     test -z "$(stg status)" &&
     stg patches foo3.txt > patches.txt &&
-    diff -u expected.txt patches.txt
+    test_cmp expected.txt patches.txt
 '
 
 cat > expected.txt <<EOF
@@ -47,7 +47,7 @@ test_expect_success 'Refresh middle patch' '
     stg status &&
     test -z "$(stg status)" &&
     stg patches foo2.txt > patches.txt &&
-    diff -u expected.txt patches.txt
+    test_cmp expected.txt patches.txt
 '
 
 cat > expected.txt <<EOF
@@ -61,7 +61,7 @@ test_expect_success 'Refresh bottom patch' '
     stg status &&
     test -z "$(stg status)" &&
     stg patches foo1.txt > patches.txt &&
-    diff -u expected.txt patches.txt
+    test_cmp expected.txt patches.txt
 '
 
 cat > expected.txt <<EOF
@@ -111,9 +111,9 @@ test_expect_success 'Refresh --index' '
     stg patches foo1.txt > patches.txt &&
     git diff HEAD^..HEAD > show.txt &&
     stg diff > diff.txt &&
-    diff -u expected.txt patches.txt &&
-    diff -u expected2.txt show.txt &&
-    diff -u expected3.txt diff.txt &&
+    test_cmp expected.txt patches.txt &&
+    test_cmp expected2.txt show.txt &&
+    test_cmp expected3.txt diff.txt &&
     stg new p5 -m "cleanup again" &&
     stg refresh
 '
diff --git a/t/t2800-goto-subdir.sh b/t/t2800-goto-subdir.sh
index fcad7da..28b8292 100755
--- a/t/t2800-goto-subdir.sh
+++ b/t/t2800-goto-subdir.sh
@@ -27,9 +27,9 @@ EOF
 test_expect_success 'Goto in subdirectory (just pop)' '
     (cd foo && stg goto p1) &&
     cat foo/bar > actual.txt &&
-    diff -u expected1.txt actual.txt &&
+    test_cmp expected1.txt actual.txt &&
     ls foo > actual.txt &&
-    diff -u expected2.txt actual.txt
+    test_cmp expected2.txt actual.txt
 '
 
 test_expect_success 'Prepare conflicting goto' '
@@ -51,9 +51,9 @@ test_expect_success 'Goto in subdirectory (conflicting push)' '
     (cd foo && stg goto p3) ;
     [ $? -eq 3 ] &&
     cat foo/bar > actual.txt &&
-    diff -u expected1.txt actual.txt &&
+    test_cmp expected1.txt actual.txt &&
     ls foo > actual.txt &&
-    diff -u expected2.txt actual.txt
+    test_cmp expected2.txt actual.txt
 '
 
 test_done

  parent reply	other threads:[~2008-04-17 21:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 21:12 [StGit PATCH 0/5] test suite update Karl Hasselström
2008-04-17 21:12 ` [StGit PATCH 1/5] If a patch is not changed when pushing, reuse the same commit object Karl Hasselström
2008-04-17 21:12 ` [StGit PATCH 2/5] Use hardcoded author and committer names in tests Karl Hasselström
2008-04-17 21:12 ` [StGit PATCH 3/5] Steal more test-lib.sh updates from git Karl Hasselström
2008-04-17 21:13 ` [StGit PATCH 4/5] Get rid of backticks in test-lib.sh Karl Hasselström
2008-04-17 21:13 ` Karl Hasselström [this message]
2008-04-17 21:14 ` [StGit PATCH 0/5] test suite update Karl Hasselström

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080417211310.12809.2112.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).