[StGit PATCH 5/5] Use test_cmp instead of diff -u in the test suite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Karl Hasselström <kha@xxxxxxxxxxx>

---

 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux