From: Karl Hasselström Date: Sun, 20 Apr 2008 13:17:42 +0000 (+0200) Subject: Use test_cmp instead of diff -u in the test suite X-Git-Tag: v0.15-rc1~241 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/d9b2f20a72706d6b4f553a8a8e25bd67f87ed616 Use test_cmp instead of diff -u in the test suite Since diff -u isn't available everywhere, and the user might want to use something else. Signed-off-by: Karl Hasselström --- 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 < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < 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 < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt <> foo/bar && stg status > output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < 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 < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < output.txt && - diff -u expected.txt output.txt + test_cmp expected.txt output.txt ' cat > expected.txt < 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 < patches.txt && - diff -u expected.txt patches.txt + test_cmp expected.txt patches.txt ' cat > expected.txt < patches.txt && - diff -u expected.txt patches.txt + test_cmp expected.txt patches.txt ' cat > expected.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