diff mbox series

[06/15] remote-mediawiki tests: use test_cmp in tests

Message ID 20200916102918.29805-7-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series remote-mediawiki: various fixes to make tests pass | expand

Commit Message

Ævar Arnfjörð Bjarmason Sept. 16, 2020, 10:29 a.m. UTC
Change code that used an ad-hoc diff invocation to use our test_cmp
helper instead. I'm also changing the order of arguments to be the
standard "test_cmp <expected> <actual>".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 contrib/mw-to-git/t/t9360-mw-to-git-clone.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jeff King Sept. 16, 2020, 6:38 p.m. UTC | #1
On Wed, Sep 16, 2020 at 12:29:09PM +0200, Ævar Arnfjörð Bjarmason wrote:

> Change code that used an ad-hoc diff invocation to use our test_cmp
> helper instead. I'm also changing the order of arguments to be the
> standard "test_cmp <expected> <actual>".

Definitely a positive direction, but...

> diff --git a/contrib/mw-to-git/t/t9360-mw-to-git-clone.sh b/contrib/mw-to-git/t/t9360-mw-to-git-clone.sh
> index 9106833578..4c39bda7bf 100755
> --- a/contrib/mw-to-git/t/t9360-mw-to-git-clone.sh
> +++ b/contrib/mw-to-git/t/t9360-mw-to-git-clone.sh
> @@ -28,7 +28,7 @@ test_expect_success 'Git clone creates the expected git log with one file' '
>  		git log --format=%s HEAD^..HEAD >log.tmp
>  	) &&
>  	echo "this must be the same" >msg.tmp &&
> -	diff -b mw_dir_1/log.tmp msg.tmp
> +	test_cmp msg.tmp mw_dir_1/log.tmp
>  '

...the original was ignoring whitespace. Is that not important?

-Peff
diff mbox series

Patch

diff --git a/contrib/mw-to-git/t/t9360-mw-to-git-clone.sh b/contrib/mw-to-git/t/t9360-mw-to-git-clone.sh
index 9106833578..4c39bda7bf 100755
--- a/contrib/mw-to-git/t/t9360-mw-to-git-clone.sh
+++ b/contrib/mw-to-git/t/t9360-mw-to-git-clone.sh
@@ -28,7 +28,7 @@  test_expect_success 'Git clone creates the expected git log with one file' '
 		git log --format=%s HEAD^..HEAD >log.tmp
 	) &&
 	echo "this must be the same" >msg.tmp &&
-	diff -b mw_dir_1/log.tmp msg.tmp
+	test_cmp msg.tmp mw_dir_1/log.tmp
 '
 
 
@@ -50,8 +50,8 @@  test_expect_success 'Git clone creates the expected git log with multiple files'
 	echo "this must be the same" >>msgDaddy.tmp &&
 	echo "identical too" >msgDj.tmp &&
 	echo "identical" >>msgDj.tmp &&
-	diff -b mw_dir_2/logDaddy.tmp msgDaddy.tmp &&
-	diff -b mw_dir_2/logDj.tmp msgDj.tmp
+	test_cmp msgDaddy.tmp mw_dir_2/logDaddy.tmp &&
+	test_cmp msgDj.tmp mw_dir_2/logDj.tmp
 '
 
 
@@ -135,7 +135,7 @@  test_expect_success 'Git clone works with one specific page cloned ' '
 		cd mw_dir_8 &&
 		echo "this log must stay" >msg.tmp &&
 		git log --format=%s >log.tmp &&
-		diff -b msg.tmp log.tmp
+		test_cmp msg.tmp log.tmp
 	) &&
 	wiki_check_content mw_dir_8/Namnam.mw Namnam
 '