Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Test-Differences for openSUSE:Factory checked in at 2022-01-14 23:12:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Test-Differences (Old) and /work/SRC/openSUSE:Factory/.perl-Test-Differences.new.1892 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-Differences" Fri Jan 14 23:12:30 2022 rev:16 rq:946097 version:0.69 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Test-Differences/perl-Test-Differences.changes 2021-05-20 19:24:06.946176682 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Test-Differences.new.1892/perl-Test-Differences.changes 2022-01-14 23:12:57.750621032 +0100 @@ -1,0 +2,11 @@ +Sat Jan 8 03:08:57 UTC 2022 - Tina M??ller <timueller+p...@suse.de> + +- updated to 0.69 + see /usr/share/doc/packages/perl-Test-Differences/Changes + + 0.69 2022-01-07 + - Special-case Unknown::Values objects in comparisons, as it's better to spit + out a diagnostic failure than to just die; + - Correct misleading Unicode doco + +------------------------------------------------------------------- Old: ---- Test-Differences-0.68.tar.gz New: ---- Test-Differences-0.69.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Test-Differences.spec ++++++ --- /var/tmp/diff_new_pack.hBtSUg/_old 2022-01-14 23:12:58.274621370 +0100 +++ /var/tmp/diff_new_pack.hBtSUg/_new 2022-01-14 23:12:58.278621373 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-Test-Differences # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define cpan_name Test-Differences Name: perl-Test-Differences -Version: 0.68 +Version: 0.69 Release: 0 #Upstream: All Rights Reserved. You may use, distribute and modify this software under the terms of the GNU public license, any version, or the Artistic license. Summary: Test strings and data structures and show differences if not ok ++++++ Test-Differences-0.68.tar.gz -> Test-Differences-0.69.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Differences-0.68/Changes new/Test-Differences-0.69/Changes --- old/Test-Differences-0.68/Changes 2021-05-18 22:29:32.000000000 +0200 +++ new/Test-Differences-0.69/Changes 2022-01-07 21:52:33.000000000 +0100 @@ -1,5 +1,10 @@ Changes file for Test::Differences +0.69 2022-01-07 + - Special-case Unknown::Values objects in comparisons, as it's better to spit + out a diagnostic failure than to just die; + - Correct misleading Unicode doco + 0.68 2021-05-18 - Revert undocumented change that was causing unreasonably verbose output See https://github.com/DrHyde/perl-modules-Test-Differences/issues/5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Differences-0.68/MANIFEST new/Test-Differences-0.69/MANIFEST --- old/Test-Differences-0.68/MANIFEST 2021-05-18 22:33:47.000000000 +0200 +++ new/Test-Differences-0.69/MANIFEST 2022-01-07 21:55:42.000000000 +0100 @@ -22,5 +22,7 @@ t/unicode.t t/lib/Test/Differences/TestUtils/Capture.pm t/sub-refs.t +t/unknown-values.t +t/script/unknown-values META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Differences-0.68/META.json new/Test-Differences-0.69/META.json --- old/Test-Differences-0.68/META.json 2021-05-18 22:33:47.000000000 +0200 +++ new/Test-Differences-0.69/META.json 2022-01-07 21:55:41.000000000 +0100 @@ -50,6 +50,6 @@ "url" : "https://github.com/DrHyde/Test-Differences" } }, - "version" : "0.68", + "version" : "0.69", "x_serialization_backend" : "JSON::PP version 4.02" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Differences-0.68/META.yml new/Test-Differences-0.69/META.yml --- old/Test-Differences-0.68/META.yml 2021-05-18 22:33:46.000000000 +0200 +++ new/Test-Differences-0.69/META.yml 2022-01-07 21:55:41.000000000 +0100 @@ -25,5 +25,5 @@ resources: bugtracker: https://github.com/DrHyde/Test-Differences/issues repository: https://github.com/DrHyde/Test-Differences -version: '0.68' +version: '0.69' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Differences-0.68/lib/Test/Differences.pm new/Test-Differences-0.69/lib/Test/Differences.pm --- old/Test-Differences-0.68/lib/Test/Differences.pm 2021-05-18 22:17:56.000000000 +0200 +++ new/Test-Differences-0.69/lib/Test/Differences.pm 2022-01-07 21:52:33.000000000 +0100 @@ -212,29 +212,6 @@ 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' => '??????' }; @@ -242,7 +219,6 @@ eq_or_diff $have, $want, 'Unicode, baby'; - Here's what you get: # Failed test 'Unicode, baby' @@ -257,90 +233,25 @@ 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 -labor by you or your users. +A patch to fix this would be *most* welcome. -=over +=head1 Unknown::Values -=item * +L<Unknown::Values> is a module which provides values which will never compare as being +the same as anything else, not even the same as itself. -Fallback to C<is_deeply>. +If code looks too hard at one of these values (and Test::Differences looks very hard indeed) +that is a fatal error. This means that while we can detect the presence of these beasties, +and tell you that they compare different, for Complicated Internals Reasons we can't show you +much context. Sorry. -This is your best option if you want this module to be optional. - - use Test::More; - BEGIN { - if (!eval q{ use Test::Differences; 1 }) { - *eq_or_diff = \&is_deeply; - } - } - -=item * - - eval "use Test::Differences"; - -If you want to detect the presence of Test::Differences on the fly, something -like the following code might do the trick for you: - - use Test qw( !ok ); ## get all syms *except* ok - - eval "use Test::Differences"; - use Data::Dumper; - - sub ok { - goto &eq_or_diff if defined &eq_or_diff && @_ > 1; - @_ = map ref $_ ? Dumper( @_ ) : $_, @_; - goto Test::&ok; - } - - plan tests => 1; - - ok "a", "b"; - -=item * - -PREREQ_PM => { .... "Test::Differences" => 0, ... } - -This method will let CPAN and CPANPLUS users download it automatically. It -will discomfit those users who choose/have to download all packages manually. - -=item * - -t/lib/Test/Differences.pm, t/lib/Text/Diff.pm, ... - -By placing Test::Differences and its prerequisites in the t/lib directory, you -avoid forcing your users to download the Test::Differences manually if they -aren't using CPAN or CPANPLUS. - -If you put a C<use lib "t/lib";> in the top of each test suite before the -C<use Test::Differences;>, C<make test> should work well. - -You might want to check once in a while for new Test::Differences releases -if you do this. - - - -=back +NB that the support for these is experimental and relies on an undocumented unstable +interface in Unknown::Values. If that fails then Test::Differences will I<probably> just die +when it sees them instead of telling you that the comparison failed. =cut -our $VERSION = "0.68"; # or "0.001_001" for a dev release +our $VERSION = "0.69"; # or "0.001_001" for a dev release $VERSION = eval $VERSION; use Exporter; @@ -477,17 +388,33 @@ local $Data::Dumper::Useperl = 1; local $Data::Dumper::Sortkeys = exists $options->{Sortkeys} ? $options->{Sortkeys} : 1; - my ( $got, $expected ) = map - [ split /^/, Data::Dumper::Dumper($_) ], - @vals; + + my $unknown_value_in_got; + my $unknown_value_in_expected; + my @unknown_flags = (\$unknown_value_in_got, \$unknown_value_in_expected); + + my($got, $expected) = map { + my $t = eval { [ split /^/, Data::Dumper::Dumper($_) ] }; + + my $unknown_flag = shift(@unknown_flags); + if($@ =~ /^Dereferencing cannot be performed on unknown values at .*Unknown.Values.Instance/) { + ${$unknown_flag} = 1; + } + + $t; + } @vals; my $caller = caller; - my $passed - = join( $joint, @$got ) eq join( $joint, @$expected ); + my $passed = + !defined($unknown_value_in_got) && + !defined($unknown_value_in_expected) && + join( $joint, @$got ) eq join( $joint, @$expected ); my $diff; unless ($passed) { + if($unknown_value_in_got) { $got = \"got something containing an Unknown::Values::unknown value" }; + if($unknown_value_in_expected) { $expected = \"expected something containing an Unknown::Values::unknown value" }; my $context; $context = $options->{context} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Differences-0.68/t/script/unknown-values new/Test-Differences-0.69/t/script/unknown-values --- old/Test-Differences-0.68/t/script/unknown-values 1970-01-01 01:00:00.000000000 +0100 +++ new/Test-Differences-0.69/t/script/unknown-values 2022-01-07 21:40:15.000000000 +0100 @@ -0,0 +1,22 @@ +use strict; +use warnings; + +use Test::More; +use Test::Differences; + +use Unknown::Values; + +my $unknown = unknown; + +my @tests = ( + # the same unknown value + sub { eq_or_diff($unknown, $unknown) }, + sub { eq_or_diff(unknown(), undef) }, + # different unknown values + sub { eq_or_diff([1, unknown()], [1, unknown()]) }, + sub { eq_or_diff([1, unknown()], [1, undef]) }, +); + +plan tests => scalar @tests; + +$_->() foreach(@tests); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Differences-0.68/t/unknown-values.t new/Test-Differences-0.69/t/unknown-values.t --- old/Test-Differences-0.68/t/unknown-values.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Test-Differences-0.69/t/unknown-values.t 2022-01-07 21:40:15.000000000 +0100 @@ -0,0 +1,55 @@ +#!perl + +use strict; +use warnings; + +use lib 't/lib'; +use Test::Differences::TestUtils::Capture; + +use Test::More; + +eval { require Unknown::Values } || plan skip_all => 'Unknown::Values is needed for these tests'; + +my $stderr = capture_error { system( + $^X, (map { "-I$_" } (@INC)), 't/script/unknown-values' +) }; + +my @expected_failures = ( +'# Failed test at t/script/unknown-values line 13. +# +----+------------------------------------------------------------+-----------------------------------------------------------------+ +# | Elt|Got |Expected | +# +----+------------------------------------------------------------+-----------------------------------------------------------------+ +# * 0|got something containing an Unknown::Values::unknown value |expected something containing an Unknown::Values::unknown value * +# +----+------------------------------------------------------------+-----------------------------------------------------------------+ +', '# Failed test at t/script/unknown-values line 14. +# +----+------------------------------------------------------------+----------+ +# | Elt|Got |Expected | +# +----+------------------------------------------------------------+----------+ +# * 0|got something containing an Unknown::Values::unknown value |undef\n * +# +----+------------------------------------------------------------+----------+ +', '# Failed test at t/script/unknown-values line 16. +# +----+------------------------------------------------------------+-----------------------------------------------------------------+ +# | Elt|Got |Expected | +# +----+------------------------------------------------------------+-----------------------------------------------------------------+ +# * 0|got something containing an Unknown::Values::unknown value |expected something containing an Unknown::Values::unknown value * +# +----+------------------------------------------------------------+-----------------------------------------------------------------+ +', '# Failed test at t/script/unknown-values line 17. +# +----+------------------------------------------------------------+----+----------+ +# | Elt|Got | Elt|Expected | +# +----+------------------------------------------------------------+----+----------+ +# * 0|got something containing an Unknown::Values::unknown value * 0|[\n * +# | | * 1| 1, * +# | | * 2| undef * +# | | * 3|] * +# +----+------------------------------------------------------------+----+----------+ +# Looks like you failed 4 tests of 4. +' +); +# We might get extra whitespace under 'make test' compared to running 'perl -Ilib t/...' +if($stderr =~ /\n\n/) { + is($stderr, join("\n", @expected_failures), 'got expected errors'); +} else { + is($stderr, join("", @expected_failures), 'got expected errors'); +} + +done_testing;