From fcf4861a1069ba50805ac30638cfe8a7b19af531 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Fri, 18 Feb 2011 16:36:17 -0800 Subject: [PATCH] s{identical}{the same}g --- lib/Test/File/Contents.pm | 16 ++++++++-------- t/10.basic.t | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/Test/File/Contents.pm b/lib/Test/File/Contents.pm index 0af9bac..10f5a19 100644 --- a/lib/Test/File/Contents.pm +++ b/lib/Test/File/Contents.pm @@ -47,7 +47,8 @@ my $Test = Test::Builder->new; file_contents_eq_or_diff $file, $string, $description; file_contents_like $file, qr/foo/, $description; file_md5sum_is $file, $md5sum, $description; - files_eq $file1, $file2, $description; + files_eq $file1, $file2, $description; + files_eq_or_diff $file1, $file2, $description; =head1 Description @@ -337,7 +338,7 @@ sub file_md5sum_is($$;$$) { files_eq $file1, $file2, { encoding => 'UTF-8' }; files_eq $file1, $file2, { encoding => ':bytes' }, $description; -Tests that the contents of two files are identical. Pass in a Unix-style file +Tests that the contents of two files are the same. Pass in a Unix-style file name and it will be converted for the local file system. Supported L: @@ -357,7 +358,7 @@ alias. sub files_eq($$;$$) { my ($f1, $f2, $desc, $opts) = @_; @_ = ($f1, $f2, $desc, $opts, sub { - " Files $f1 and $f2 are not identical." + " Files $f1 and $f2 are not the same." }); goto &_files_eq; } @@ -368,9 +369,9 @@ sub files_eq($$;$$) { files_eq_or_diff $file1, $file2, { encoding => 'UTF-8' }; files_eq_or_diff $file1, $file2, { style => 'context' }, $description; -Like C, this function tests that the contents of two files are -identical. Unlike C, on failure this function outputs a diff of -the two files in the diagnostics. Supported L: +Like C, this function tests that the contents of two files are the +same. Unlike C, on failure this function outputs a diff of the two +files in the diagnostics. Supported L: =over @@ -401,7 +402,6 @@ sub files_eq_or_diff($$;$$) { sub _files_eq { my ($f1, $f2, $desc, $opts, $diag) = @_; ($opts, $desc) = ($desc, $opts) if ref $desc eq 'HASH'; - $desc ||= "$f1 and $f2 contents identical"; my @contents; for my $f ($f1, $f2) { @@ -414,7 +414,7 @@ sub _files_eq { return $Test->ok( $contents[0] eq $contents[1], - $desc || "$f1 and $f2 contents identical", + $desc || "$f1 and $f2 contents are the same", ) || $Test->diag($diag->()); } diff --git a/t/10.basic.t b/t/10.basic.t index c96213c..553cd70 100644 --- a/t/10.basic.t +++ b/t/10.basic.t @@ -278,13 +278,13 @@ test_out("ok 1 - aaa identical test"); files_eq("t/data/aaa.txt", "t/data/aaa2.txt", "aaa identical test"); test_test("files_eq works when correct"); -test_out("ok 1 - t/data/aaa.txt and t/data/aaa2.txt contents identical"); +test_out("ok 1 - t/data/aaa.txt and t/data/aaa2.txt contents are the same"); files_eq("t/data/aaa.txt", "t/data/aaa2.txt"); test_test("files_eq works when correct with default text"); -test_out("not ok 1 - t/data/aaa.txt and t/data/bbb.txt contents identical"); +test_out("not ok 1 - t/data/aaa.txt and t/data/bbb.txt contents are the same"); test_fail(+2); -test_diag(" Files t/data/aaa.txt and t/data/bbb.txt are not identical."); +test_diag(" Files t/data/aaa.txt and t/data/bbb.txt are not the same."); files_eq("t/data/aaa.txt", "t/data/bbb.txt"); test_test("files_eq works when incorrect"); @@ -293,7 +293,7 @@ test_out("ok 1 - whatever"); files_eq('t/data/utf8.txt', 't/data/utf8-2.txt', { encoding => 'UTF-8' }, 'whatever'); test_test("files_eq works with UTF-8 decoding"); -test_out("ok 1 - t/data/utf8.txt and t/data/utf8-2.txt contents identical"); +test_out("ok 1 - t/data/utf8.txt and t/data/utf8-2.txt contents are the same"); files_eq('t/data/utf8.txt', 't/data/utf8-2.txt'); test_test("files_eq works without UTF-8 decoding"); @@ -301,7 +301,7 @@ test_out("ok 1 - whatever"); files_eq('t/data/utf8.txt', 't/data/utf8-2.txt', 'whatever', { encoding => 'Big5' }); test_test("files_eq works with Big5 decoding"); -test_out("ok 1 - t/data/utf8.txt and t/data/utf8-2.txt contents identical"); +test_out("ok 1 - t/data/utf8.txt and t/data/utf8-2.txt contents are the same"); files_eq('t/data/utf8.txt', 't/data/utf8-2.txt', { encoding => ':raw' }); test_test("files_eq works with :raw decoding"); @@ -378,7 +378,7 @@ test_out("ok 1 - aaa identical test"); files_eq_or_diff("t/data/aaa.txt", "t/data/aaa2.txt", "aaa identical test"); test_test("files_eq_or_diff works when correct"); -test_out("ok 1 - t/data/aaa.txt and t/data/aaa2.txt contents identical"); +test_out("ok 1 - t/data/aaa.txt and t/data/aaa2.txt contents are the same"); files_eq_or_diff("t/data/aaa.txt", "t/data/aaa2.txt"); test_test("files_eq_or_diff works when correct with default text"); @@ -387,7 +387,7 @@ test_out("ok 1 - whatever"); files_eq_or_diff('t/data/utf8.txt', 't/data/utf8-2.txt', { encoding => 'UTF-8' }, 'whatever'); test_test("files_eq_or_diff works with UTF-8 decoding"); -test_out("ok 1 - t/data/utf8.txt and t/data/utf8-2.txt contents identical"); +test_out("ok 1 - t/data/utf8.txt and t/data/utf8-2.txt contents are the same"); files_eq_or_diff('t/data/utf8.txt', 't/data/utf8-2.txt'); test_test("files_eq_or_diff works without UTF-8 decoding"); @@ -395,12 +395,12 @@ test_out("ok 1 - whatever"); files_eq_or_diff('t/data/utf8.txt', 't/data/utf8-2.txt', 'whatever', { encoding => 'Big5' }); test_test("files_eq_or_diff works with Big5 decoding"); -test_out("ok 1 - t/data/utf8.txt and t/data/utf8-2.txt contents identical"); +test_out("ok 1 - t/data/utf8.txt and t/data/utf8-2.txt contents are the same"); files_eq_or_diff('t/data/utf8.txt', 't/data/utf8-2.txt', { encoding => ':raw' }); test_test("files_eq_or_diff works with :raw decoding"); # Diagnostics. -test_out("not ok 1 - t/data/aaa.txt and t/data/bbb.txt contents identical"); +test_out("not ok 1 - t/data/aaa.txt and t/data/bbb.txt contents are the same"); test_fail(+8); test_diag( '--- t/data/aaa.txt Fri Feb 18 09:54:53 2011', @@ -413,7 +413,7 @@ files_eq_or_diff("t/data/aaa.txt", "t/data/bbb.txt"); test_test("files_eq_or_diff failure emits diff"); # Try style. -test_out("not ok 1 - t/data/aaa.txt and t/data/bbb.txt contents identical"); +test_out("not ok 1 - t/data/aaa.txt and t/data/bbb.txt contents are the same"); test_fail(+10); test_diag( '*** t/data/aaa.txt Fri Feb 18 09:54:53 2011',