Hello community,
here is the log from the commit of package perl-Test-Differences for
openSUSE:Factory checked in at 2011-11-21 12:47:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Test-Differences (Old)
and /work/SRC/openSUSE:Factory/.perl-Test-Differences.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-Differences", Maintainer is ""
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Test-Differences/perl-Test-Differences.changes
2011-09-23 12:39:03.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Test-Differences.new/perl-Test-Differences.changes
2011-11-21 12:47:06.000000000 +0100
@@ -1,0 +2,12 @@
+Sun Nov 20 12:31:30 UTC 2011 - [email protected]
+
+- update to 0.61
+ - Allow an option to override Sortkeys in C<eq_or_diff>. Thanks to Mark
+ Zealey for the suggestion.
+ - Unnumbered tests. There's no point to them.
+ - Make '' and undef not equal. Thanks to Pavel Shaydo for the patch.
+ - Made Data::Dumper minimum version 2.126 to resolve
+ https://rt.cpan.org/Ticket/Display.html?id=60798. Thanks to
+ [email protected] for the report and fix.
+
+-------------------------------------------------------------------
Old:
----
Test-Differences-0.500.tar.gz
New:
----
Test-Differences-0.61.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Test-Differences.spec ++++++
--- /var/tmp/diff_new_pack.OTS5d3/_old 2011-11-21 12:47:07.000000000 +0100
+++ /var/tmp/diff_new_pack.OTS5d3/_new 2011-11-21 12:47:07.000000000 +0100
@@ -19,13 +19,13 @@
Name: perl-Test-Differences
-Version: 0.500
+Version: 0.61
Release: 1
Summary: Test strings and data structures and show differences if not ok
Source:
http://search.cpan.org/CPAN/authors/id/O/OV/OVID/Test-Differences-%{version}.tar.gz
Url: http://search.cpan.org/dist/Test-Differences/
Group: Development/Libraries/Perl
-License: Perl License
+License: GPL-1.0+ or Artistic
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{perl_requires}
BuildRequires: make perl
@@ -34,6 +34,8 @@
BuildRequires: perl(Test::Pod::Coverage)
BuildRequires: perl(Text::Diff)
Requires: perl(Text::Diff)
+# MANUAL
+Provides: perl(Test::Diferences) = 0.600
%description
Test strings and data structures and show differences if not ok.
@@ -53,9 +55,6 @@
%check
%__make test
-%clean
-%{?buildroot:%__rm -rf "%{buildroot}"}
-
%files
%defattr(-,root,root)
%doc Changes README
@@ -64,4 +63,5 @@
%dir %{perl_vendorarch}/auto/Test
%{perl_vendorarch}/auto/Test/Differences
%doc %{perl_man3dir}/Test::Differences.%{perl_man3ext}%{ext_man}
+
%changelog
++++++ Test-Differences-0.500.tar.gz -> Test-Differences-0.61.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/Build.PL
new/Test-Differences-0.61/Build.PL
--- old/Test-Differences-0.500/Build.PL 2009-10-17 16:25:47.000000000 +0200
+++ new/Test-Differences-0.61/Build.PL 2011-04-16 17:04:14.000000000 +0200
@@ -3,16 +3,21 @@
use Module::Build;
my $builder = Module::Build->new(
- module_name => 'Test::Differences',
- license => 'perl',
- dist_author => 'Curtis "Ovid" Poe <[email protected]>',
- dist_version_from => 'lib/Test/Differences.pm',
- perl => 5.006,
- requires => {
- 'Test::More' => 0,
- 'Text::Diff' => 0.35,
+ module_name => 'Test::Differences',
+ license => 'perl',
+ dist_author => 'Curtis "Ovid" Poe <[email protected]>',
+ dist_version_from => 'lib/Test/Differences.pm',
+ perl => 5.006,
+ requires => {
+ 'Test::More' => 0,
+ 'Text::Diff' => 0.35,
+ 'Data::Dumper' => 2.126,
+ },
+ add_to_cleanup => ['Test-Differences-*'],
+ meta_merge => {
+ resources =>
+ { repository => 'https://github.com/Ovid/Test-Differences' }
},
- add_to_cleanup => [ 'Test-Differences-*' ],
);
$builder->create_build_script();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/Changes
new/Test-Differences-0.61/Changes
--- old/Test-Differences-0.500/Changes 2009-10-17 16:25:47.000000000 +0200
+++ new/Test-Differences-0.61/Changes 2011-04-16 17:04:14.000000000 +0200
@@ -1,5 +1,16 @@
Changes file for Test::Differences
+0.61 Sat April 16, 2011
+ - Allow an option to override Sortkeys in C<eq_or_diff>. Thanks to Mark
+ Zealey for the suggestion.
+ - Unnumbered tests. There's no point to them.
+
+0.60 Sat April 16, 2011
+ - Make '' and undef not equal. Thanks to Pavel Shaydo for the patch.
+ - Made Data::Dumper minimum version 2.126 to resolve
+ https://rt.cpan.org/Ticket/Display.html?id=60798. Thanks to
+ [email protected] for the report and fix.
+
0.50 Sat Oct 17 15:18:03 2009
- Production release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/MANIFEST
new/Test-Differences-0.61/MANIFEST
--- old/Test-Differences-0.500/MANIFEST 2009-10-17 16:25:47.000000000 +0200
+++ new/Test-Differences-0.61/MANIFEST 2011-04-16 17:04:14.000000000 +0200
@@ -5,12 +5,13 @@
MANIFEST
README
t/00-load.t
-t/00flatten.t
-t/01text_vs_data.t
-t/02pass.t
-t/03struct.t
-t/10test.t
-t/99example.t
+t/flatten.t
+t/text_vs_data.t
+t/pass.t
+t/struct.t
+t/test.t
+t/undef.t
+t/example.t
t/diff_styles.t
t/boilerplate.t
t/pod-coverage.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/META.yml
new/Test-Differences-0.61/META.yml
--- old/Test-Differences-0.500/META.yml 2009-10-17 16:25:47.000000000 +0200
+++ new/Test-Differences-0.61/META.yml 2011-04-16 17:04:14.000000000 +0200
@@ -1,22 +1,24 @@
---
-name: Test-Differences
-version: 0.500
+abstract: 'Test strings and data structures and show differences if not ok'
author:
- - 'Curtis "Ovid" Poe <[email protected]>'
-abstract: Test strings and data structures and show differences if not ok
-license: perl
-resources:
- license: http://dev.perl.org/licenses/
-requires:
- Test::More: 0
- Text::Diff: 0.35
+ - "Curtis \"Ovid\" Poe <[email protected]>"
configure_requires:
- Module::Build: 0.35
-provides:
- Test::Differences:
- file: lib/Test/Differences.pm
- version: 0.500
-generated_by: Module::Build version 0.35
+ Module::Build: 0.36
+generated_by: 'Module::Build version 0.3607'
+license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
+name: Test-Differences
+provides:
+ Test::Differences:
+ file: lib/Test/Differences.pm
+ version: 0.61
+requires:
+ Data::Dumper: 2.126
+ Test::More: 0
+ Text::Diff: 0.35
+resources:
+ license: http://dev.perl.org/licenses/
+ repository: https://github.com/Ovid/Test-Differences
+version: 0.61
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/Makefile.PL
new/Test-Differences-0.61/Makefile.PL
--- old/Test-Differences-0.500/Makefile.PL 2009-10-17 16:25:47.000000000
+0200
+++ new/Test-Differences-0.61/Makefile.PL 2011-04-16 17:04:14.000000000
+0200
@@ -3,21 +3,26 @@
use ExtUtils::MakeMaker;
eval "use 5.006";
-if (my $error = $@) {
+if ( my $error = $@ ) {
warn $error;
exit 0;
}
WriteMakefile(
- NAME => 'Test::Differences',
- AUTHOR => 'Curtis "Ovid" Poe <[email protected]>',
- VERSION_FROM => 'lib/Test/Differences.pm',
- ABSTRACT_FROM => 'lib/Test/Differences.pm',
- PL_FILES => {},
- PREREQ_PM => {
- 'Test::More' => 0,
- 'Text::Diff' => 0.35,
+ NAME => 'Test::Differences',
+ AUTHOR => 'Curtis "Ovid" Poe <[email protected]>',
+ VERSION_FROM => 'lib/Test/Differences.pm',
+ ABSTRACT_FROM => 'lib/Test/Differences.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ 'Text::Diff' => 0.35,
+ 'Data::Dumper' => 2.126,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'Test-Differences-*' },
+ META_MERGE => {
+ resources =>
+ { repository => 'https://github.com/Ovid/Test-Differences' }
},
- dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
- clean => { FILES => 'Test-Differences-*' },
);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/lib/Test/Differences.pm
new/Test-Differences-0.61/lib/Test/Differences.pm
--- old/Test-Differences-0.500/lib/Test/Differences.pm 2009-10-17
16:25:47.000000000 +0200
+++ new/Test-Differences-0.61/lib/Test/Differences.pm 2011-04-16
17:04:14.000000000 +0200
@@ -4,6 +4,10 @@
Test::Differences - Test strings and data structures and show differences if
not ok
+=head1 VERSION
+
+0.61
+
=head1 SYNOPSIS
use Test; ## Or use Test::More
@@ -20,7 +24,7 @@
use DBI;
... open connection & prepare statement and @expected_... here...
-
+
eq_or_diff $sth->fetchall_arrayref, \@expected_arrays "testing DBI arrays";
eq_or_diff $sth->fetchall_hashref, \@expected_hashes, "testing DBI hashes";
@@ -139,8 +143,13 @@
=head1 OPTIONS
-There is currently only one option: "context". This allows you to
-control the amount of context shown:
+The options to C<eq_or_diff> give some fine-grained control over the output.
+
+=over 4
+
+=item * C<context>
+
+This allows you to control the amount of context shown:
eq_or_diff $got, $expected, $name, { context => 50000 };
@@ -148,6 +157,19 @@
some heuristics to determine whether to show 3 lines of context (like
a normal unified diff) or 25 lines.
+=item * C<data_type>
+
+C<text> or C<data>. See C<eq_or_diff_text> and C<eq_or_diff_data> to
+understand this. You can usually ignore this.
+
+=item * C<Sortkeys>
+
+If passed, whatever value is added is used as the argument for L<Data::Dumper>
+Sortkeys option. See the L<Data::Dumper> docs to understand how you can
+control the Sortkeys behavior.
+
+=back
+
=head1 DIFF STYLES
For extremely long strings, a table diff can wrap on your screen and be hard
@@ -171,9 +193,9 @@
use Test::More 'no_plan';
use Test::Differences;
-
+
my $long_string = join '' => 1..40;
-
+
TODO: {
local $TODO = 'Testing diff styles';
@@ -192,7 +214,7 @@
eq_or_diff $long_string, "-$long_string", 'oldstyle diff';
}
-=head1 DEPLOYING
+=head1 DEPLOYING
There are several basic ways of deploying Test::Differences requiring more or
less
labor by you or your users.
@@ -261,15 +283,15 @@
=cut
-our $VERSION = "0.500"; # or "0.001_001" for a dev release
+our $VERSION = "0.61"; # or "0.001_001" for a dev release
$VERSION = eval $VERSION;
use Exporter;
@ISA = qw( Exporter );
-@EXPORT = qw(
- eq_or_diff
- eq_or_diff_text
+@EXPORT = qw(
+ eq_or_diff
+ eq_or_diff_text
eq_or_diff_data
unified_diff
context_diff
@@ -340,7 +362,7 @@
my $type = shift;
local $_ = shift if @_;
- return [ split /^/m ] unless ref;
+ return [ split /^/m, _quote_str($_) ] unless ref;
croak "Can't flatten $_" unless $type;
@@ -355,7 +377,10 @@
else {
die "unsupported ref type";
}
- if ( $type eq ARRAY_of_ARRAYs_of_scalars ) {
+ if ( $type eq ARRAY_of_scalars) {
+ @recs = map { _quote_str($_) } @recs;
+ }
+ elsif ( $type eq ARRAY_of_ARRAYs_of_scalars ) {
## Also copy the inner arrays if need be
$_ = [@$_] for @recs;
}
@@ -382,10 +407,10 @@
}
if ( $type eq ARRAY_of_ARRAYs_of_scalars ) {
- ## Convert undefs
+ ## Quote strings
for my $rec (@recs) {
for (@$rec) {
- $_ = "<undef>" unless defined;
+ $_ = _quote_str($_);
}
$rec = join ",", @$rec;
}
@@ -394,6 +419,14 @@
return \@recs;
}
+sub _quote_str {
+ my $str = shift;
+ return 'undef' unless defined $str;
+ return $str if $str =~ /^[0-9]+$/;
+ $str =~ s{([\\\'])}{\\$1}g;
+ return "'$str'";
+}
+
sub _identify_callers_test_package_of_choice {
## This is called at each test in case Test::Differences was used before
## the base testing modules.
@@ -443,11 +476,12 @@
if ($dump_it) {
require Data::Dumper;
local $Data::Dumper::Indent = 1;
- local $Data::Dumper::Sortkeys = 1;
local $Data::Dumper::Purity = 0;
local $Data::Dumper::Terse = 1;
local $Data::Dumper::Deepcopy = 1;
local $Data::Dumper::Quotekeys = 0;
+ local $Data::Dumper::Sortkeys =
+ exists $options->{Sortkeys} ? $options->{Sortkeys} : 1;
( $got, $expected ) = map
[ split /^/, Data::Dumper::Dumper($_) ],
@vals;
@@ -569,17 +603,17 @@
not ok 5
# Failed test (t/ctrl/05-home.t at line 51)
- # +----+------------------------+----+------------------------+
- # | Elt|Got | Elt|Expected |
- # +----+------------------------+----+------------------------+
- # | 0|{ | 0|{ |
- # | 1| 'password' => '', | 1| 'password' => '', |
- # * 2| 'method' => 'login', * | |
- # | 3| 'ctrl' => 'home', | 2| 'ctrl' => 'home', |
- # | | * 3| 'method' => 'login', *
- # | 4| 'email' => 'test' | 4| 'email' => 'test' |
- # | 5|} | 5|} |
- # +----+------------------------+----+------------------------+
+ # +----+------------------------+----+------------------------+
+ # | Elt|Got | Elt|Expected |
+ # +----+------------------------+----+------------------------+
+ # | 0|{ | 0|{ |
+ # | 1| 'password' => '', | 1| 'password' => '', |
+ # * 2| 'method' => 'login', * | |
+ # | 3| 'ctrl' => 'home', | 2| 'ctrl' => 'home', |
+ # | | * 3| 'method' => 'login', *
+ # | 4| 'email' => 'test' | 4| 'email' => 'test' |
+ # | 5|} | 5|} |
+ # +----+------------------------+----+------------------------+
Data::Dumper also overlooks the difference between
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/00flatten.t
new/Test-Differences-0.61/t/00flatten.t
--- old/Test-Differences-0.500/t/00flatten.t 2009-10-17 16:25:47.000000000
+0200
+++ new/Test-Differences-0.61/t/00flatten.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,27 +0,0 @@
-use Test::More;
-
-use Test::Differences;
-
-sub flatten($) {
- my $out = join "|",
- @{
- Test::Differences::_flatten( Test::Differences::_grok_type( $_[0] ),
- $_[0] )
- };
- $out =~ s/ +//g;
- $out;
-}
-## Complex data structures are not flattened, they're dumped, so don't
-## test that here.
-my @cases = (
- "a" => "a",
- "a\nb\n" => "a\n|b\n",
- [qw( a b )] => "a|b",
- [ [qw( a b )], [qw(c d)] ] => "a,b|c,d",
- [ { a => 0, b => 1 }, { a => 2, c => 3 } ] =>
"a,b,c|0,1,<undef>|2,<undef>,3"
-);
-
-plan tests => @cases / 2;
-while ( my ( $data, $result ) = splice @cases, 0, 2 ) {
- is flatten $data, $result, $result;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/01text_vs_data.t
new/Test-Differences-0.61/t/01text_vs_data.t
--- old/Test-Differences-0.500/t/01text_vs_data.t 2009-10-17
16:25:47.000000000 +0200
+++ new/Test-Differences-0.61/t/01text_vs_data.t 1970-01-01
01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-use Test::More;
-use Test::Differences;
-
-# use large enough data sets that this thing chooses context => 3 instead
-# of "full document context".
-my $a = ( "\n" x 30 ) . "a\n";
-my $b = ( "\n" x 30 ) . "b\n";
-
-my @tests = (
- sub { eq_or_diff $a, $b },
- sub { eq_or_diff_text $a, $b },
- sub { eq_or_diff_data $a, $b },
-);
-
-plan tests => scalar @tests;
-
-TODO: {
- local $TODO = 'Force the output to be displayed';
- $_->() for @tests;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/02pass.t
new/Test-Differences-0.61/t/02pass.t
--- old/Test-Differences-0.500/t/02pass.t 2009-10-17 16:25:47.000000000
+0200
+++ new/Test-Differences-0.61/t/02pass.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,15 +0,0 @@
-use Test::More;
-use Test::Differences;
-
-# use large enough data sets that this thing chooses context => 3 instead
-# of "full document context".
-my $a = ( "\n" x 30 ) . "a\n";
-my $b = ( "\n" x 30 ) . "b\n";
-
-my @tests = (
- sub { eq_or_diff [ "a", "b" ], [ "a", "b" ] },
-);
-
-plan tests => scalar @tests;
-
-$_->() for @tests;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/03struct.t
new/Test-Differences-0.61/t/03struct.t
--- old/Test-Differences-0.500/t/03struct.t 2009-10-17 16:25:47.000000000
+0200
+++ new/Test-Differences-0.61/t/03struct.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,19 +0,0 @@
-use Test::More;
-
-use Test::Differences;
-
-## This mind-bender submitted by Yves Orton <[email protected]>
-my ( $ar, $x, $y );
-$ar->[0] = \$ar->[1];
-$ar->[1] = \$ar->[0];
-$x = \$y;
-$y = \$x;
-
-my @tests = (
- sub { eq_or_diff [ \"a", \"b" ], [ \"a", \"b" ] },
- sub { eq_or_diff $ar, [ $x, $y ] },
-);
-
-plan tests => scalar @tests;
-
-$_->() for @tests;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/10test.t
new/Test-Differences-0.61/t/10test.t
--- old/Test-Differences-0.500/t/10test.t 2009-10-17 16:25:47.000000000
+0200
+++ new/Test-Differences-0.61/t/10test.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,20 +0,0 @@
-use Test::More;
-
-use Test::Differences;
-
-my @tests = (
- sub { eq_or_diff "a", "b" },
- sub { eq_or_diff "a\nb\nc\n", "a\nc\n" },
- sub { eq_or_diff "a\nb\nc\n", "a\nB\nc\n" },
- sub { eq_or_diff "a\nb\nc\nd\ne\n", "a\nc\ne\n" },
- sub { eq_or_diff "a\nb\nc\nd\ne\n", "a\nb\nd\ne\n", { context => 0 } },
- sub { eq_or_diff "a\nb\nc\nd\ne\n", "a\nb\nd\ne\n", { context => 10 } },
-);
-
-plan tests => scalar @tests;
-diag "This test misuses TODO: these TODOs are actually real tests.\n";
-
-TODO: {
- local $TODO = 'Deliberate misuse of TODO';
- $_->() for @tests;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/99example.t
new/Test-Differences-0.61/t/99example.t
--- old/Test-Differences-0.500/t/99example.t 2009-10-17 16:25:47.000000000
+0200
+++ new/Test-Differences-0.61/t/99example.t 1970-01-01 01:00:00.000000000
+0100
@@ -1,41 +0,0 @@
-use strict;
-my $x;
-
-my $demo = $ENV{DEMO};
-
-eval <<'PRELOAD' ? eval <<'TEST' : ( $x = $@, eval <<'FALLBACK' );
- use Test::More;
- 1;
-PRELOAD
- use Test::Differences;
-
- plan tests => 3 ;
-
- print "#\n# This test misuses TODO:",
- " these TODOs are actually real tests.\n#\n"
- unless $demo;
- TODO: {
- local $TODO = "testing failure, not really a TODO" unless $demo;
- my @docs = (
- join( "", map "this is line $_\n", qw( 1 2 3 ) ),
- join( "", map "this is line $_\n", qw( 1 b 3 ) )
- );
- eq_or_diff @docs, "differences in text";
-
- @docs = ( ( " indented\n" x 3 ) x 2 );
-
- $docs[1] =~ s/(^..*?^)\s+/$1\t/ms or die "Can't subst \\t for ' '";
-
- eq_or_diff @docs, "differences in whitespace";
-
- eq_or_diff( Test::Builder->new, [ "Dry, humorless message" ] );
- }
-TEST
- use Test;
-
- plan tests => 1;
-
- skip $x, "" ;
-FALLBACK
-
-die $@ if $@;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/example.t
new/Test-Differences-0.61/t/example.t
--- old/Test-Differences-0.500/t/example.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Test-Differences-0.61/t/example.t 2011-04-16 17:04:14.000000000
+0200
@@ -0,0 +1,41 @@
+use strict;
+my $x;
+
+my $demo = $ENV{DEMO};
+
+eval <<'PRELOAD' ? eval <<'TEST' : ( $x = $@, eval <<'FALLBACK' );
+ use Test::More;
+ 1;
+PRELOAD
+ use Test::Differences;
+
+ plan tests => 3 ;
+
+ print "#\n# This test misuses TODO:",
+ " these TODOs are actually real tests.\n#\n"
+ unless $demo;
+ TODO: {
+ local $TODO = "testing failure, not really a TODO" unless $demo;
+ my @docs = (
+ join( "", map "this is line $_\n", qw( 1 2 3 ) ),
+ join( "", map "this is line $_\n", qw( 1 b 3 ) )
+ );
+ eq_or_diff @docs, "differences in text";
+
+ @docs = ( ( " indented\n" x 3 ) x 2 );
+
+ $docs[1] =~ s/(^..*?^)\s+/$1\t/ms or die "Can't subst \\t for ' '";
+
+ eq_or_diff @docs, "differences in whitespace";
+
+ eq_or_diff( Test::Builder->new, [ "Dry, humorless message" ] );
+ }
+TEST
+ use Test;
+
+ plan tests => 1;
+
+ skip $x, "" ;
+FALLBACK
+
+die $@ if $@;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/flatten.t
new/Test-Differences-0.61/t/flatten.t
--- old/Test-Differences-0.500/t/flatten.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Test-Differences-0.61/t/flatten.t 2011-04-16 17:04:14.000000000
+0200
@@ -0,0 +1,29 @@
+use Test::More;
+
+use Test::Differences;
+
+sub flatten($) {
+ my $out = join "|",
+ @{
+ Test::Differences::_flatten( Test::Differences::_grok_type( $_[0] ),
+ $_[0] )
+ };
+ $out =~ s/ +//g;
+ $out;
+}
+## Complex data structures are not flattened, they're dumped, so don't
+## test that here.
+my @cases = (
+ "a" => "'a'",
+ "a\nb\n" => "'a\n|b\n|'",
+ [qw( a b )] => "'a'|'b'",
+ [ [qw( a b )], [qw(c d)] ] => "'a','b'|'c','d'",
+ [ { a => 0, b => 1 }, { a => 2, c => 3 } ] =>
+ "'a','b','c'|0,1,undef|2,undef,3",
+ [ 1, undef, "undef" ] => "1|undef|'undef'",
+);
+
+plan tests => @cases / 2;
+while ( my ( $data, $result ) = splice @cases, 0, 2 ) {
+ is flatten $data, $result, $result;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/pass.t
new/Test-Differences-0.61/t/pass.t
--- old/Test-Differences-0.500/t/pass.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Test-Differences-0.61/t/pass.t 2011-04-16 17:04:14.000000000 +0200
@@ -0,0 +1,15 @@
+use Test::More;
+use Test::Differences;
+
+# use large enough data sets that this thing chooses context => 3 instead
+# of "full document context".
+my $a = ( "\n" x 30 ) . "a\n";
+my $b = ( "\n" x 30 ) . "b\n";
+
+my @tests = (
+ sub { eq_or_diff [ "a", "b" ], [ "a", "b" ] },
+);
+
+plan tests => scalar @tests;
+
+$_->() for @tests;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/struct.t
new/Test-Differences-0.61/t/struct.t
--- old/Test-Differences-0.500/t/struct.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Test-Differences-0.61/t/struct.t 2011-04-16 17:04:14.000000000
+0200
@@ -0,0 +1,19 @@
+use Test::More;
+
+use Test::Differences;
+
+## This mind-bender submitted by Yves Orton <[email protected]>
+my ( $ar, $x, $y );
+$ar->[0] = \$ar->[1];
+$ar->[1] = \$ar->[0];
+$x = \$y;
+$y = \$x;
+
+my @tests = (
+ sub { eq_or_diff [ \"a", \"b" ], [ \"a", \"b" ] },
+ sub { eq_or_diff $ar, [ $x, $y ] },
+);
+
+plan tests => scalar @tests;
+
+$_->() for @tests;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/test.t
new/Test-Differences-0.61/t/test.t
--- old/Test-Differences-0.500/t/test.t 1970-01-01 01:00:00.000000000 +0100
+++ new/Test-Differences-0.61/t/test.t 2011-04-16 17:04:14.000000000 +0200
@@ -0,0 +1,20 @@
+use Test::More;
+
+use Test::Differences;
+
+my @tests = (
+ sub { eq_or_diff "a", "b" },
+ sub { eq_or_diff "a\nb\nc\n", "a\nc\n" },
+ sub { eq_or_diff "a\nb\nc\n", "a\nB\nc\n" },
+ sub { eq_or_diff "a\nb\nc\nd\ne\n", "a\nc\ne\n" },
+ sub { eq_or_diff "a\nb\nc\nd\ne\n", "a\nb\nd\ne\n", { context => 0 } },
+ sub { eq_or_diff "a\nb\nc\nd\ne\n", "a\nb\nd\ne\n", { context => 10 } },
+);
+
+plan tests => scalar @tests;
+diag "This test misuses TODO: these TODOs are actually real tests.\n";
+
+TODO: {
+ local $TODO = 'Deliberate misuse of TODO';
+ $_->() for @tests;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/text_vs_data.t
new/Test-Differences-0.61/t/text_vs_data.t
--- old/Test-Differences-0.500/t/text_vs_data.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Test-Differences-0.61/t/text_vs_data.t 2011-04-16 17:04:14.000000000
+0200
@@ -0,0 +1,20 @@
+use Test::More;
+use Test::Differences;
+
+# use large enough data sets that this thing chooses context => 3 instead
+# of "full document context".
+my $a = ( "\n" x 30 ) . "a\n";
+my $b = ( "\n" x 30 ) . "b\n";
+
+my @tests = (
+ sub { eq_or_diff $a, $b },
+ sub { eq_or_diff_text $a, $b },
+ sub { eq_or_diff_data $a, $b },
+);
+
+plan tests => scalar @tests;
+
+TODO: {
+ local $TODO = 'Force the output to be displayed';
+ $_->() for @tests;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.500/t/undef.t
new/Test-Differences-0.61/t/undef.t
--- old/Test-Differences-0.500/t/undef.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Test-Differences-0.61/t/undef.t 2011-04-16 17:04:14.000000000 +0200
@@ -0,0 +1,22 @@
+use Test::More qw(no_plan);
+use Test::Differences;
+
+TODO: {
+ local $TODO = "Should fail";
+ eq_or_diff( undef, "", "undef eq ''" );
+ eq_or_diff( undef, [], "undef eq []" );
+ eq_or_diff( undef, 0, "undef eq 0" );
+ eq_or_diff( "", 0, "'' eq 0" );
+ eq_or_diff( [ 1, undef ], [ 1, "" ], "undef eq '' in array" );
+ eq_or_diff( [ 1, [ 2, undef ] ], [ 1, [ 2, "" ] ], "undef eq ''
in deep array" );
+ eq_or_diff( [ [1], [ 2, undef ] ], [ [1], [ 2, "" ] ], "undef eq ''
in AoAoS" );
+ eq_or_diff( [ [1], [ 2, undef ] ], [ [1], [ 2, "<undef>" ] ], "undef eq
<undef> in AoAoS" );
+ eq_or_diff( [ 1, undef ], [ 1, ], "arrays of different length are equal" );
+ eq_or_diff( { aa => undef }, { aa => '' }, "undef eq '' in hash" );
+ eq_or_diff( { aa => undef }, { aa => '<undef>' }, "undef eq <undef> in
hash" );
+}
+
+my $builder = Test::More->builder;
+eq_or_diff [ map { $_->{actual_ok} } $builder->details ], [ map { 0 }
$builder->details ],
+ "All TODO tests failed";
+
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]