Hello community,
here is the log from the commit of package perl-Test-Differences for
openSUSE:Factory checked in at 2014-09-17 17:25:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Test-Differences (Old)
and /work/SRC/openSUSE:Factory/.perl-Test-Differences.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-Differences"
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Test-Differences/perl-Test-Differences.changes
2011-12-27 18:15:34.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Test-Differences.new/perl-Test-Differences.changes
2014-09-17 17:25:43.000000000 +0200
@@ -1,0 +2,7 @@
+Mon Sep 15 15:15:09 UTC 2014 - [email protected]
+
+- updated to 0.62
+ - Document the Text::Diff unicode fix.
+ - Add ability to customise 'Got' and 'Expected' column headers
+
+-------------------------------------------------------------------
Old:
----
Test-Differences-0.61.tar.gz
New:
----
Test-Differences-0.62.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Test-Differences.spec ++++++
--- /var/tmp/diff_new_pack.D9oh2c/_old 2014-09-17 17:25:43.000000000 +0200
+++ /var/tmp/diff_new_pack.D9oh2c/_new 2014-09-17 17:25:43.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Test-Differences
#
-# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,50 +17,50 @@
Name: perl-Test-Differences
-Version: 0.61
+Version: 0.62
Release: 0
+%define cpan_name Test-Differences
Summary: Test strings and data structures and show differences if not ok
License: GPL-1.0+ or Artistic-1.0
Group: Development/Libraries/Perl
-Source:
http://search.cpan.org/CPAN/authors/id/O/OV/OVID/Test-Differences-%{version}.tar.gz
Url: http://search.cpan.org/dist/Test-Differences/
+Source:
http://www.cpan.org/authors/id/D/DC/DCANTRELL/%{cpan_name}-%{version}.tar.gz
+BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-%{perl_requires}
-BuildRequires: make
BuildRequires: perl
BuildRequires: perl-macros
-BuildRequires: perl(Test::Pod)
-BuildRequires: perl(Test::Pod::Coverage)
-BuildRequires: perl(Text::Diff)
-Requires: perl(Text::Diff)
-# MANUAL
-Provides: perl(Test::Differences) = 0.600
+BuildRequires: perl(Capture::Tiny) >= 0.24
+BuildRequires: perl(Data::Dumper) >= 2.126
+BuildRequires: perl(Module::Build)
+BuildRequires: perl(Text::Diff) >= 0.35
+Requires: perl(Capture::Tiny) >= 0.24
+Requires: perl(Data::Dumper) >= 2.126
+Requires: perl(Text::Diff) >= 0.35
+%{perl_requires}
%description
-Test strings and data structures and show differences if not ok.
+When the code you're testing returns multiple lines, records or data
+structures and they're just plain wrong, an equivalent to the Unix 'diff'
+utility may be just what's needed. Here's output from an example test
+script that checks two text documents and then two (trivial) data
+structures:
%prep
-%setup -q -n "Test-Differences-%{version}"
-%__sed -i '/^auto_install/d' Makefile.PL
+%setup -q -n %{cpan_name}-%{version}
%build
-%__perl Makefile.PL PREFIX="%{_prefix}"
-%__make %{?jobs:-j%{jobs}}
-
-%install
-%perl_make_install
-%perl_process_packlist
+%{__perl} Build.PL installdirs=vendor
+./Build build flags=%{?_smp_mflags}
%check
-%__make test
+./Build test
+
+%install
+./Build install destdir=%{buildroot} create_packlist=0
+%perl_gen_filelist
-%files
-%defattr(-,root,root)
+%files -f %{name}.files
+%defattr(-,root,root,755)
%doc Changes README
-%dir %{perl_vendorlib}/Test
-%{perl_vendorlib}/Test/Differences.pm
-%dir %{perl_vendorarch}/auto/Test
-%{perl_vendorarch}/auto/Test/Differences
-%doc %{perl_man3dir}/Test::Differences.%{perl_man3ext}%{ext_man}
%changelog
++++++ Test-Differences-0.61.tar.gz -> Test-Differences-0.62.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/Build.PL
new/Test-Differences-0.62/Build.PL
--- old/Test-Differences-0.61/Build.PL 2011-04-16 17:04:14.000000000 +0200
+++ new/Test-Differences-0.62/Build.PL 2014-06-25 18:32:27.000000000 +0200
@@ -5,13 +5,14 @@
my $builder = Module::Build->new(
module_name => 'Test::Differences',
license => 'perl',
- dist_author => 'Curtis "Ovid" Poe <[email protected]>',
+ dist_author => 'David Cantrell <[email protected]',
dist_version_from => 'lib/Test/Differences.pm',
perl => 5.006,
requires => {
- 'Test::More' => 0,
- 'Text::Diff' => 0.35,
- 'Data::Dumper' => 2.126,
+ 'Test::More' => 0,
+ 'Text::Diff' => 0.35,
+ 'Data::Dumper' => 2.126,
+ 'Capture::Tiny' => 0.24,
},
add_to_cleanup => ['Test-Differences-*'],
meta_merge => {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/Changes
new/Test-Differences-0.62/Changes
--- old/Test-Differences-0.61/Changes 2011-04-16 17:04:14.000000000 +0200
+++ new/Test-Differences-0.62/Changes 2014-06-25 18:44:06.000000000 +0200
@@ -1,5 +1,12 @@
Changes file for Test::Differences
+0.62 Wed June 25, 2014
+ - Production release
+
+0.61_01 Thu June 19, 2014
+ - Document the Text::Diff unicode fix.
+ - Add ability to customise 'Got' and 'Expected' column headers
+
0.61 Sat April 16, 2011
- Allow an option to override Sortkeys in C<eq_or_diff>. Thanks to Mark
Zealey for the suggestion.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/MANIFEST
new/Test-Differences-0.62/MANIFEST
--- old/Test-Differences-0.61/MANIFEST 2011-04-16 17:04:14.000000000 +0200
+++ new/Test-Differences-0.62/MANIFEST 2014-06-25 18:50:12.000000000 +0200
@@ -18,3 +18,7 @@
t/pod.t
t/regression.t
META.yml Module meta-data (added by MakeMaker)
+t/column-headers.t
+t/script/custom-headers
+t/script/default-headers
+META.json Module JSON meta-data (added by
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/META.json
new/Test-Differences-0.62/META.json
--- old/Test-Differences-0.61/META.json 1970-01-01 01:00:00.000000000 +0100
+++ new/Test-Differences-0.62/META.json 2014-06-25 18:50:12.000000000 +0200
@@ -0,0 +1,49 @@
+{
+ "abstract" : "Test strings and data structures and show differences if not
ok",
+ "author" : [
+ "David Cantrell <[email protected]>"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter
version 2.112150",
+ "license" : [
+ "unknown"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Test-Differences",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : 0
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : 0
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Capture::Tiny" : "0.24",
+ "Data::Dumper" : "2.126",
+ "Test::More" : 0,
+ "Text::Diff" : "0.35"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "repository" : {
+ "url" : "https://github.com/Ovid/Test-Differences"
+ }
+ },
+ "version" : "0.62"
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/META.yml
new/Test-Differences-0.62/META.yml
--- old/Test-Differences-0.61/META.yml 2011-04-16 17:04:14.000000000 +0200
+++ new/Test-Differences-0.62/META.yml 2014-06-25 18:50:12.000000000 +0200
@@ -1,24 +1,27 @@
---
abstract: 'Test strings and data structures and show differences if not ok'
author:
- - "Curtis \"Ovid\" Poe <[email protected]>"
+ - 'David Cantrell <[email protected]>'
+build_requires:
+ ExtUtils::MakeMaker: 0
configure_requires:
- Module::Build: 0.36
-generated_by: 'Module::Build version 0.3607'
-license: perl
+ ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version
2.112150'
+license: unknown
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
+no_index:
+ directory:
+ - t
+ - inc
requires:
+ Capture::Tiny: 0.24
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
+version: 0.62
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/Makefile.PL
new/Test-Differences-0.62/Makefile.PL
--- old/Test-Differences-0.61/Makefile.PL 2011-04-16 17:04:14.000000000
+0200
+++ new/Test-Differences-0.62/Makefile.PL 2014-06-25 18:32:27.000000000
+0200
@@ -10,14 +10,15 @@
WriteMakefile(
NAME => 'Test::Differences',
- AUTHOR => 'Curtis "Ovid" Poe <[email protected]>',
+ AUTHOR => 'David Cantrell <[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,
+ 'Test::More' => 0,
+ 'Text::Diff' => 0.35,
+ 'Data::Dumper' => 2.126,
+ 'Capture::Tiny' => 0.24,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'Test-Differences-*' },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/lib/Test/Differences.pm
new/Test-Differences-0.62/lib/Test/Differences.pm
--- old/Test-Differences-0.61/lib/Test/Differences.pm 2011-04-16
17:04:14.000000000 +0200
+++ new/Test-Differences-0.62/lib/Test/Differences.pm 2014-06-25
18:43:13.000000000 +0200
@@ -1,12 +1,14 @@
package Test::Differences;
+=encoding utf8
+
=head1 NAME
Test::Differences - Test strings and data structures and show differences if
not ok
=head1 VERSION
-0.61
+0.62
=head1 SYNOPSIS
@@ -168,6 +170,10 @@
Sortkeys option. See the L<Data::Dumper> docs to understand how you can
control the Sortkeys behavior.
+=item * C<filename_a> and C<filename_b>
+
+The column headers to use in the output. They default to 'Got' and 'Expected'.
+
=back
=head1 DIFF STYLES
@@ -214,6 +220,70 @@
eq_or_diff $long_string, "-$long_string", 'oldstyle diff';
}
+=head1 UNICODE
+
+Generally you'll find that the following test output is disappointing.
+
+ use Test::Differences;
+
+ my $want = { 'Traditional Chinese' => '中國' };
+ my $have = { 'Traditional Chinese' => '中国' };
+
+ eq_or_diff $have, $want, 'Unicode, baby';
+
+The output looks like this:
+
+ # Failed test 'Unicode, baby'
+ # at t/unicode.t line 12.
+ # +----+----------------------------+----------------------------+
+ # | Elt|Got |Expected |
+ # +----+----------------------------+----------------------------+
+ # | 0|'Traditional Chinese' |'Traditional Chinese' |
+ # * 1|'\xe4\xb8\xad\xe5\x9b\xbd' |'\xe4\xb8\xad\xe5\x9c\x8b' *
+ # +----+----------------------------+----------------------------+
+ # Looks like you failed 1 test of 1.
+ Dubious, test returned 1 (wstat 256, 0x100)
+
+This is generally not helpful and someone points out that you didn't declare
+your test program as being utf8, so you do that:
+
+ use Test::Differences;
+ use utf8;
+
+ my $want = { 'Traditional Chinese' => '中國' };
+ my $have = { 'Traditional Chinese' => '中国' };
+
+ eq_or_diff $have, $want, 'Unicode, baby';
+
+
+Here's what you get:
+
+ # Failed test 'Unicode, baby'
+ # at t/unicode.t line 12.
+ # +----+-----------------------+-----------------------+
+ # | Elt|Got |Expected |
+ # +----+-----------------------+-----------------------+
+ # | 0|'Traditional Chinese' |'Traditional Chinese' |
+ # * 1|'\x{4e2d}\x{56fd}' |'\x{4e2d}\x{570b}' *
+ # +----+-----------------------+-----------------------+
+ # Looks like you failed 1 test of 1.
+ Dubious, test returned 1 (wstat 256, 0x100)
+ Failed 1/1 subtests
+
+That's better, but still awful. However, if you have C<Text::Diff> 0.40 or
+higher installed, you can add this to your code:
+
+ BEGIN { $ENV{DIFF_OUTPUT_UNICODE} = 1 }
+
+Make sure you do this I<before> you load L<Text::Diff>. Then this is the
output:
+
+ # +----+-----------------------+-----------------------+
+ # | Elt|Got |Expected |
+ # +----+-----------------------+-----------------------+
+ # | 0|'Traditional Chinese' |'Traditional Chinese' |
+ # * 1|'中国' |'中國' *
+ # +----+-----------------------+-----------------------+
+
=head1 DEPLOYING
There are several basic ways of deploying Test::Differences requiring more or
less
@@ -283,7 +353,7 @@
=cut
-our $VERSION = "0.61"; # or "0.001_001" for a dev release
+our $VERSION = "0.62"; # or "0.001_001" for a dev release
$VERSION = eval $VERSION;
use Exporter;
@@ -461,11 +531,18 @@
$options = pop if @_ > 2 && ref $_[-1];
( $vals[0], $vals[1], $name ) = @_;
- my $data_type;
- $data_type = $options->{data_type} if $options;
+ my($data_type, $filename_a, $filename_b);
+ if($options) {
+ $data_type = $options->{data_type};
+ $filename_a = $options->{filename_a};
+ $filename_b = $options->{filename_b};
+ }
$data_type ||= "text" unless ref $vals[0] || ref $vals[1];
$data_type ||= "data";
+ $filename_a ||= 'Got';
+ $filename_b ||= 'Expected';
+
my @widths;
my @types = map _grok_type, @vals;
@@ -514,8 +591,8 @@
$diff = diff $got, $expected,
{ CONTEXT => $context,
STYLE => _diff_style(),
- FILENAME_A => "Got",
- FILENAME_B => "Expected",
+ FILENAME_A => $filename_a,
+ FILENAME_B => $filename_b,
OFFSET_A => $data_type eq "text" ? 1 : 0,
OFFSET_B => $data_type eq "text" ? 1 : 0,
INDEX_LABEL => $data_type eq "text" ? "Ln" : "Elt",
@@ -632,14 +709,14 @@
you to select Data::Denter or some other module of your choice as an
option.
-=head1 AUTHOR
-
- Barrie Slaymaker <[email protected]>
+=head1 AUTHORS
-=head1 MAINTAINER
+ Barrie Slaymaker <[email protected]> - original author
Curtis "Ovid" Poe <[email protected]>
+ David Cantrell <[email protected]>
+
=head1 LICENSE
Copyright 2001-2008 Barrie Slaymaker, All Rights Reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/t/column-headers.t
new/Test-Differences-0.62/t/column-headers.t
--- old/Test-Differences-0.61/t/column-headers.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Test-Differences-0.62/t/column-headers.t 2014-06-25
18:32:27.000000000 +0200
@@ -0,0 +1,51 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Config;
+use Capture::Tiny qw(capture);
+
+END { done_testing(); }
+
+my($stdout, $stderr) = capture { system (
+ $Config{perlpath}, (map { "-I$_" } (@INC)),
+ 't/script/default-headers'
+) };
+
+is(
+ $stderr,
+"
+# Failed test 'both the same'
+# at t/script/default-headers line 8.
+# +----+-------+----------+
+# | Elt|Got |Expected |
+# +----+-------+----------+
+# | 0|'foo' |'foo' |
+# * 1|'bar' |'baz' *
+# +----+-------+----------+
+# Looks like you failed 1 test of 1.
+",
+ "got expected error output"
+);
+
+($stdout, $stderr) = capture { system (
+ $Config{perlpath}, (map { "-I$_" } (@INC)),
+ 't/script/custom-headers'
+) };
+
+is(
+ $stderr,
+"
+# Failed test 'both the same'
+# at t/script/custom-headers line 8.
+# +----+-------+-------+
+# | Elt|Lard |Chips |
+# +----+-------+-------+
+# | 0|'foo' |'foo' |
+# * 1|'bar' |'baz' *
+# +----+-------+-------+
+# Looks like you failed 1 test of 1.
+",
+ "got expected error output"
+);
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/t/script/custom-headers
new/Test-Differences-0.62/t/script/custom-headers
--- old/Test-Differences-0.61/t/script/custom-headers 1970-01-01
01:00:00.000000000 +0100
+++ new/Test-Differences-0.62/t/script/custom-headers 2014-06-25
18:32:27.000000000 +0200
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Differences;
+END { done_testing(); }
+
+eq_or_diff(
+ { foo => 'bar' },
+ { foo => 'baz' },
+ "both the same",
+ { filename_a => 'Lard', filename_b => 'Chips' }
+);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/t/script/default-headers
new/Test-Differences-0.62/t/script/default-headers
--- old/Test-Differences-0.61/t/script/default-headers 1970-01-01
01:00:00.000000000 +0100
+++ new/Test-Differences-0.62/t/script/default-headers 2014-06-25
18:32:27.000000000 +0200
@@ -0,0 +1,12 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Differences;
+END { done_testing(); }
+
+eq_or_diff(
+ { foo => 'bar' },
+ { foo => 'baz' },
+ "both the same"
+);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Test-Differences-0.61/t/undef.t
new/Test-Differences-0.62/t/undef.t
--- old/Test-Differences-0.61/t/undef.t 2011-04-16 17:04:14.000000000 +0200
+++ new/Test-Differences-0.62/t/undef.t 2014-06-25 18:32:27.000000000 +0200
@@ -17,6 +17,14 @@
}
my $builder = Test::More->builder;
-eq_or_diff [ map { $_->{actual_ok} } $builder->details ], [ map { 0 }
$builder->details ],
- "All TODO tests failed";
-
+# The Test::Builder 1.5 way to do it
+if ( $builder->can('history') ) {
+ is $builder->history->pass_count - $builder->history->todo_count,
+ $builder->history->literal_pass_count,
+ "All TODO tests failed";
+}
+# The Test::Builder 0.x way to do it
+else {
+ 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]