Skip to content

Commit

Permalink
s{identical}{the same}g
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Feb 19, 2011
1 parent a305825 commit fcf4861
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions lib/Test/File/Contents.pm
Expand Up @@ -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
Expand Down Expand Up @@ -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<options|/Options>:
Expand All @@ -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;
}
Expand All @@ -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<files_eq()>, this function tests that the contents of two files are
identical. Unlike C<files_eq()>, on failure this function outputs a diff of
the two files in the diagnostics. Supported L<options|/Options>:
Like C<files_eq()>, this function tests that the contents of two files are the
same. Unlike C<files_eq()>, on failure this function outputs a diff of the two
files in the diagnostics. Supported L<options|/Options>:
=over
Expand Down Expand Up @@ -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) {
Expand All @@ -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->());
}

Expand Down
20 changes: 10 additions & 10 deletions t/10.basic.t
Expand Up @@ -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");

Expand All @@ -293,15 +293,15 @@ 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");

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");

Expand Down Expand Up @@ -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");

Expand All @@ -387,20 +387,20 @@ 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");

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',
Expand All @@ -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',
Expand Down

0 comments on commit fcf4861

Please sign in to comment.