Hello community,
here is the log from the commit of package perl-Carp-Assert-More for
openSUSE:Factory checked in at 2020-10-10 00:28:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Carp-Assert-More (Old)
and /work/SRC/openSUSE:Factory/.perl-Carp-Assert-More.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Carp-Assert-More"
Sat Oct 10 00:28:31 2020 rev:10 rq:840238 version:1.24
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-Carp-Assert-More/perl-Carp-Assert-More.changes
2019-08-13 13:20:11.793435245 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Carp-Assert-More.new.4249/perl-Carp-Assert-More.changes
2020-10-10 00:28:34.353129853 +0200
@@ -1,0 +2,14 @@
+Thu Oct 8 03:07:06 UTC 2020 - Tina Müller <[email protected]>
+
+- updated to 1.24
+ see /usr/share/doc/packages/perl-Carp-Assert-More/Changes
+
+ 1.24 Tue Oct 6 22:37:06 CDT 2020
+ [ENHANCEMENTS]
+ The requirement for Perl 5.10 has been reverted to 5.6.1.
+
+ 1.22 Tue Oct 6 22:03:55 CDT 2020
+ [ENHANCEMENTS]
+ Add assert_keys_are() for asserting an exact list of keys.
+
+-------------------------------------------------------------------
Old:
----
Carp-Assert-More-1.20.tar.gz
New:
----
Carp-Assert-More-1.24.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Carp-Assert-More.spec ++++++
--- /var/tmp/diff_new_pack.dBP6rf/_old 2020-10-10 00:28:35.061130204 +0200
+++ /var/tmp/diff_new_pack.dBP6rf/_new 2020-10-10 00:28:35.065130206 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Carp-Assert-More
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,13 +17,13 @@
Name: perl-Carp-Assert-More
-Version: 1.20
+Version: 1.24
Release: 0
%define cpan_name Carp-Assert-More
Summary: Convenience wrappers around Carp::Assert
License: Artistic-2.0
Group: Development/Libraries/Perl
-Url: https://metacpan.org/release/%{cpan_name}
+URL: https://metacpan.org/release/%{cpan_name}
Source0:
https://cpan.metacpan.org/authors/id/P/PE/PETDANCE/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
++++++ Carp-Assert-More-1.20.tar.gz -> Carp-Assert-More-1.24.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/Changes
new/Carp-Assert-More-1.24/Changes
--- old/Carp-Assert-More-1.20/Changes 2019-08-09 17:13:48.000000000 +0200
+++ new/Carp-Assert-More-1.24/Changes 2020-10-07 05:37:17.000000000 +0200
@@ -1,5 +1,13 @@
Revision history for Perl extension Carp::Assert::More.
+1.24 Tue Oct 6 22:37:06 CDT 2020
+ [ENHANCEMENTS]
+ The requirement for Perl 5.10 has been reverted to 5.6.1.
+
+1.22 Tue Oct 6 22:03:55 CDT 2020
+ [ENHANCEMENTS]
+ Add assert_keys_are() for asserting an exact list of keys.
+
1.20 Fri Aug 9 10:10:06 CDT 2019
[ENHANCEMENTS]
Add assert_datetime() for asserting DateTime objects.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/MANIFEST
new/Carp-Assert-More-1.24/MANIFEST
--- old/Carp-Assert-More-1.20/MANIFEST 2019-08-09 17:14:02.000000000 +0200
+++ new/Carp-Assert-More-1.24/MANIFEST 2020-10-07 05:43:49.000000000 +0200
@@ -21,6 +21,7 @@
t/assert_isa.t
t/assert_isa_in.t
t/assert_isnt.t
+t/assert_keys_are.t
t/assert_lacks.t
t/assert_like.t
t/assert_listref.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/META.json
new/Carp-Assert-More-1.24/META.json
--- old/Carp-Assert-More-1.20/META.json 2019-08-09 17:14:02.000000000 +0200
+++ new/Carp-Assert-More-1.24/META.json 2020-10-07 05:43:49.000000000 +0200
@@ -4,13 +4,13 @@
"unknown"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.16, CPAN::Meta::Converter
version 2.150005",
+ "generated_by" : "ExtUtils::MakeMaker version 7.46, CPAN::Meta::Converter
version 2.150010",
"license" : [
"artistic_2"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Carp-Assert-More",
"no_index" : {
@@ -52,6 +52,6 @@
"url" : "https://github.com/petdance/carp-assert-more/tree/master"
}
},
- "version" : "1.20",
- "x_serialization_backend" : "JSON::PP version 2.27400"
+ "version" : "1.24",
+ "x_serialization_backend" : "JSON::PP version 4.05"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/META.yml
new/Carp-Assert-More-1.24/META.yml
--- old/Carp-Assert-More-1.20/META.yml 2019-08-09 17:14:02.000000000 +0200
+++ new/Carp-Assert-More-1.24/META.yml 2020-10-07 05:43:49.000000000 +0200
@@ -7,7 +7,7 @@
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.16, CPAN::Meta::Converter version
2.150005'
+generated_by: 'ExtUtils::MakeMaker version 7.46, CPAN::Meta::Converter version
2.150010'
license: artistic_2
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -27,5 +27,5 @@
bugtracker:
https://rt.cpan.org/Public/Dist/Display.html?Name=Carp-Assert-More
license: http://www.opensource.org/licenses/artistic-license-2.0.php
repository: https://github.com/petdance/carp-assert-more/tree/master
-version: '1.20'
-x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
+version: '1.24'
+x_serialization_backend: 'CPAN::Meta::YAML version 0.011'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/More.pm
new/Carp-Assert-More-1.24/More.pm
--- old/Carp-Assert-More-1.20/More.pm 2019-08-09 17:13:48.000000000 +0200
+++ new/Carp-Assert-More-1.24/More.pm 2020-10-07 05:38:49.000000000 +0200
@@ -15,12 +15,12 @@
=head1 VERSION
-Version 1.20
+Version 1.24
=cut
BEGIN {
- $VERSION = '1.20';
+ $VERSION = '1.24';
@ISA = qw(Exporter);
@EXPORT = qw(
assert_all_keys_in
@@ -39,6 +39,7 @@
assert_isa
assert_isa_in
assert_isnt
+ assert_keys_are
assert_lacks
assert_like
assert_listref
@@ -690,9 +691,11 @@
=cut
-sub assert_datetime {
+sub assert_datetime($;$) {
my $datetime = shift;
- my $desc = shift // 'Must be a DateTime object';
+ my $desc = shift;
+
+ $desc = 'Must be a DateTime object' unless defined($desc);
assert_isa( $datetime, 'DateTime', $desc );
@@ -796,13 +799,13 @@
=cut
-sub assert_all_keys_in {
+sub assert_all_keys_in($$;$) {
my $hash = shift;
my $valid_keys = shift;
my $name = shift;
assert_hashref( $hash );
- assert_listref( $valid_keys );
+ assert_arrayref( $valid_keys );
foreach my $key ( keys %{$hash} ) {
assert_in( $key, $valid_keys, $name );
@@ -812,6 +815,29 @@
}
+=head2 assert_keys_are( \%hash, \@keys [, $name ] )
+
+Asserts that the keys for C<%hash> are exactly C<@keys>, no more and no less.
+
+=cut
+
+sub assert_keys_are($$;$) {
+ my $hash = shift;
+ my $valid_keys = shift;
+ my $name = shift;
+
+ assert_hashref( $hash );
+ assert_arrayref( $valid_keys );
+
+ foreach my $key ( keys %{$hash} ) {
+ assert_in( $key, $valid_keys, $name );
+ }
+
+ assert_is(scalar keys %{$hash}, scalar @{$valid_keys}, 'There are the
correct number of keys');
+
+ return;
+}
+
=head1 UTILITY ASSERTIONS
@@ -839,7 +865,7 @@
=head1 COPYRIGHT & LICENSE
-Copyright 2005-2019 Andy Lester.
+Copyright 2005-2020 Andy Lester.
This program is free software; you can redistribute it and/or modify
it under the terms of the Artistic License version 2.0.
@@ -859,4 +885,4 @@
=cut
-"I stood on the porch in a tie."
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/README.md
new/Carp-Assert-More-1.24/README.md
--- old/Carp-Assert-More-1.20/README.md 2017-08-04 21:18:59.000000000 +0200
+++ new/Carp-Assert-More-1.24/README.md 2020-10-07 05:07:41.000000000 +0200
@@ -2,13 +2,331 @@
[](https://travis-ci.org/petdance/carp-assert-more)
-Carp::Assert::More is a set of handy assertion functions for Perl.
+# NAME
-For example, instead of writing
+Carp::Assert::More - convenience wrappers around Carp::Assert
- assert( defined($foo), '$foo cannot be undefined' );
- assert( $foo ne '', '$foo cannot be blank' );
+# VERSION
-you can write
+Version 1.20
- assert_nonblank( $foo, '$foo cannot be blank' );
+# SYNOPSIS
+
+A set of convenience functions for common assertions.
+
+ use Carp::Assert::More;
+
+ my $obj = My::Object;
+ assert_isa( $obj, 'My::Object', 'Got back a correct object' );
+
+# DESCRIPTION
+
+Carp::Assert::More is a set of wrappers around the
[Carp::Assert](https://metacpan.org/pod/Carp::Assert) functions
+to make the habit of writing assertions even easier.
+
+Everything in here is effectively syntactic sugar. There's no technical
+reason to use
+
+ assert_isa( $foo, 'HTML::Lint' );
+
+instead of
+
+ assert( defined $foo );
+ assert( ref($foo) eq 'HTML::Lint' );
+
+other than readability and simplicity of the code.
+
+My intent here is to make common assertions easy so that we as programmers
+have no excuse to not use them.
+
+# CAVEATS
+
+I haven't specifically done anything to make Carp::Assert::More be
+backwards compatible with anything besides Perl 5.6.1, much less back
+to 5.004. Perhaps someone with better testing resources in that area
+can help me out here.
+
+# SIMPLE ASSERTIONS
+
+## assert\_is( $string, $match \[,$name\] )
+
+Asserts that _$string_ matches _$match_.
+
+## assert\_isnt( $string, $unmatch \[,$name\] )
+
+Asserts that _$string_ does NOT match _$unmatch_.
+
+## assert\_like( $string, qr/regex/ \[,$name\] )
+
+Asserts that _$string_ matches _qr/regex/_.
+
+The assertion fails either the string or the regex are undef.
+
+## assert\_unlike( $string, qr/regex/ \[,$name\] )
+
+Asserts that _$string_ matches _qr/regex/_.
+
+The assertion fails if the regex is undef.
+
+## assert\_defined( $this \[, $name\] )
+
+Asserts that _$this_ is defined.
+
+## assert\_undefined( $this \[, $name\] )
+
+Asserts that _$this_ is not defined.
+
+## assert\_nonblank( $this \[, $name\] )
+
+Asserts that _$this_ is not blank and not a reference.
+
+# NUMERIC ASSERTIONS
+
+## assert\_numeric( $n \[, $name\] )
+
+Asserts that `$n` looks like a number, according to
`Scalar::Util::looks_like_number`.
+
+## assert\_integer( $this \[, $name \] )
+
+Asserts that _$this_ is an integer, which may be zero or negative.
+
+ assert_integer( 0 ); # pass
+ assert_integer( 14 ); # pass
+ assert_integer( -14 ); # pass
+ assert_integer( '14.' ); # FAIL
+
+## assert\_nonzero( $this \[, $name \] )
+
+Asserts that the numeric value of _$this_ is not zero.
+
+ assert_nonzero( 0 ); # FAIL
+ assert_nonzero( -14 ); # pass
+ assert_nonzero( '14.' ); # pass
+
+Asserts that the numeric value of _$this_ is not zero.
+
+## assert\_positive( $this \[, $name \] )
+
+Asserts that the numeric value of _$this_ is greater than zero.
+
+ assert_positive( 0 ); # FAIL
+ assert_positive( -14 ); # FAIL
+ assert_positive( '14.' ); # pass
+
+## assert\_nonnegative( $this \[, $name \] )
+
+Asserts that the numeric value of _$this_ is greater than or equal
+to zero. Since non-numeric strings evaluate to zero, this means that
+any non-numeric string will pass.
+
+ assert_nonnegative( 0 ); # pass
+ assert_nonnegative( -14 ); # FAIL
+ assert_nonnegative( '14.' ); # pass
+ assert_nonnegative( 'dog' ); # pass
+
+## assert\_negative( $this \[, $name \] )
+
+Asserts that the numeric value of _$this_ is less than zero.
+
+ assert_negative( 0 ); # FAIL
+ assert_negative( -14 ); # pass
+ assert_negative( '14.' ); # FAIL
+
+## assert\_nonzero\_integer( $this \[, $name \] )
+
+Asserts that the numeric value of _$this_ is not zero, and that _$this_
+is an integer.
+
+ assert_nonzero_integer( 0 ); # FAIL
+ assert_nonzero_integer( -14 ); # pass
+ assert_nonzero_integer( '14.' ); # FAIL
+
+## assert\_positive\_integer( $this \[, $name \] )
+
+Asserts that the numeric value of _$this_ is greater than zero, and
+that _$this_ is an integer.
+
+ assert_positive_integer( 0 ); # FAIL
+ assert_positive_integer( -14 ); # FAIL
+ assert_positive_integer( '14.' ); # FAIL
+ assert_positive_integer( '14' ); # pass
+
+## assert\_nonnegative\_integer( $this \[, $name \] )
+
+Asserts that the numeric value of _$this_ is not less than zero, and
+that _$this_ is an integer.
+
+ assert_nonnegative_integer( 0 ); # pass
+ assert_nonnegative_integer( -14 ); # pass
+ assert_nonnegative_integer( '14.' ); # FAIL
+
+## assert\_negative\_integer( $this \[, $name \] )
+
+Asserts that the numeric value of _$this_ is less than zero, and that
+_$this_ is an integer.
+
+ assert_negative_integer( 0 ); # FAIL
+ assert_negative_integer( -14 ); # pass
+ assert_negative_integer( '14.' ); # FAIL
+
+# REFERENCE ASSERTIONS
+
+## assert\_isa( $this, $type \[, $name \] )
+
+Asserts that _$this_ is an object of type _$type_.
+
+## assert\_isa\_in( $obj, \\@types \[, $description\] )
+
+Assert that the blessed `$obj` isa one of the types in `\@types`.
+
+ assert_isa_in( $obj, [ 'My::Foo', 'My::Bar' ], 'Must pass either a Foo or
Bar object' );
+
+## assert\_empty( $this \[, $name \] )
+
+_$this_ must be a ref to either a hash or an array. Asserts that that
+collection contains no elements. Will assert (with its own message,
+not _$name_) unless given a hash or array ref. It is OK if _$this_ has
+been blessed into objecthood, but the semantics of checking an object to see
+if it does not have keys (for a hashref) or returns 0 in scalar context (for
+an array ref) may not be what you want.
+
+ assert_empty( 0 ); # FAIL
+ assert_empty( 'foo' ); # FAIL
+ assert_empty( undef ); # FAIL
+ assert_empty( {} ); # pass
+ assert_empty( [] ); # pass
+ assert_empty( {foo=>1} );# FAIL
+ assert_empty( [1,2,3] ); # FAIL
+
+## assert\_nonempty( $this \[, $name \] )
+
+_$this_ must be a ref to either a hash or an array. Asserts that that
+collection contains at least 1 element. Will assert (with its own message,
+not _$name_) unless given a hash or array ref. It is OK if _$this_ has
+been blessed into objecthood, but the semantics of checking an object to see
+if it has keys (for a hashref) or returns >0 in scalar context (for an array
+ref) may not be what you want.
+
+ assert_nonempty( 0 ); # FAIL
+ assert_nonempty( 'foo' ); # FAIL
+ assert_nonempty( undef ); # FAIL
+ assert_nonempty( {} ); # FAIL
+ assert_nonempty( [] ); # FAIL
+ assert_nonempty( {foo=>1} );# pass
+ assert_nonempty( [1,2,3] ); # pass
+
+## assert\_nonref( $this \[, $name \] )
+
+Asserts that _$this_ is not undef and not a reference.
+
+## assert\_hashref( $ref \[,$name\] )
+
+Asserts that _$ref_ is defined, and is a reference to a (possibly empty) hash.
+
+**NB:** This method returns _false_ for objects, even those whose underlying
+data is a hashref. This is as it should be, under the assumptions that:
+
+- (a)
+
+ you shouldn't rely on the underlying data structure of a particular class,
and
+
+- (b)
+
+ you should use `assert_isa` instead.
+
+## assert\_arrayref( $ref \[, $name\] )
+
+## assert\_listref( $ref \[,$name\] )
+
+Asserts that _$ref_ is defined, and is a reference to a (possibly empty) list.
+
+**NB:** The same caveat about objects whose underlying structure is a
+hash (see `assert_hashref`) applies here; this method returns false
+even for objects whose underlying structure is an array.
+
+`assert_listref` is an alias for `assert_arrayref` and may go away in
+the future. Use `assert_arrayref` instead.
+
+## assert\_aoh( $ref \[, $name \] )
+
+Verifies that `$array` is an arrayref, and that every element is a hashref.
+
+The array `$array` can be an empty arraref and the assertion will pass.
+
+## assert\_coderef( $ref \[,$name\] )
+
+Asserts that _$ref_ is defined, and is a reference to a closure.
+
+# TYPE-SPECIFIC ASSERTIONS
+
+## assert\_datetime( $date )
+
+Asserts that `$date` is a DateTime object.
+
+# SET AND HASH MEMBERSHIP
+
+## assert\_in( $string, \\@inlist \[,$name\] );
+
+Asserts that _$string_ is defined and matches one of the elements
+of _\\@inlist_.
+
+_\\@inlist_ must be an array reference of defined strings.
+
+## assert\_exists( \\%hash, $key \[,$name\] )
+
+## assert\_exists( \\%hash, \\@keylist \[,$name\] )
+
+Asserts that _%hash_ is indeed a hash, and that _$key_ exists in
+_%hash_, or that all of the keys in _@keylist_ exist in _%hash_.
+
+ assert_exists( \%custinfo, 'name', 'Customer has a name field' );
+
+ assert_exists( \%custinfo, [qw( name addr phone )],
+ 'Customer has name, address and phone' );
+
+## assert\_lacks( \\%hash, $key \[,$name\] )
+
+## assert\_lacks( \\%hash, \\@keylist \[,$name\] )
+
+Asserts that _%hash_ is indeed a hash, and that _$key_ does NOT exist
+in _%hash_, or that none of the keys in _@keylist_ exist in _%hash_.
+
+ assert_lacks( \%users, 'root', 'Root is not in the user table' );
+
+ assert_lacks( \%users, [qw( root admin nobody )], 'No bad usernames found'
);
+
+## assert\_all\_keys\_in( \\%hash, \\@names \[, $name \] )
+
+Asserts that each key in `%hash` is in the list of `@names`.
+
+This is used to ensure that there are no extra keys in a given hash.
+
+ assert_all_keys_in( $obj, [qw( height width depth )], '$obj can only
contain height, width and depth keys' );
+
+# UTILITY ASSERTIONS
+
+## assert\_fail( \[$name\] )
+
+Assertion that always fails. `assert_fail($msg)` is exactly the same
+as calling `assert(0,$msg)`, but it eliminates that case where you
+accidentally use `assert($msg)`, which of course never fires.
+
+# COPYRIGHT & LICENSE
+
+Copyright 2005-2019 Andy Lester.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the Artistic License version 2.0.
+
+# ACKNOWLEDGEMENTS
+
+Thanks to
+Eric A. Zarko,
+Bob Diss,
+Pete Krawczyk,
+David Storrs,
+Dan Friedman,
+Allard Hoeve,
+Thomas L. Shinnick,
+and Leland Johnson
+for code and fixes.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/t/assert_datetime.t
new/Carp-Assert-More-1.24/t/assert_datetime.t
--- old/Carp-Assert-More-1.20/t/assert_datetime.t 2019-08-09
17:13:48.000000000 +0200
+++ new/Carp-Assert-More-1.24/t/assert_datetime.t 2020-10-07
05:07:41.000000000 +0200
@@ -7,9 +7,10 @@
use Carp::Assert::More;
-my $rc = eval 'use DateTime; 1;';
-if ( !$rc ) {
- plan skip_all => 'DateTime must be installed to test assert_datetime()';
+my $module = 'DateTime';
+
+if ( !eval "use $module; 1;" ) { ## no critic (ProhibitStringyEval)
+ plan skip_all => "$module required for testing assert_datetime()";
}
plan tests => 11;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/t/assert_isa_in.t
new/Carp-Assert-More-1.24/t/assert_isa_in.t
--- old/Carp-Assert-More-1.20/t/assert_isa_in.t 2019-07-20 00:14:38.000000000
+0200
+++ new/Carp-Assert-More-1.24/t/assert_isa_in.t 2020-10-07 05:07:41.000000000
+0200
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use Test::More tests => 13;
+use Test::More tests => 20;
use Carp::Assert::More;
use Test::Exception;
@@ -28,9 +28,7 @@
dies_ok { assert_isa_in( bless({}, 'x'), [ 'y' ] ) } 'Parent does not match
child';
-subtest assert_isa_in => sub {
- plan tests => 8;
-
+ASSERT_ISA_IN: {
package a;
sub foo {}
package main;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/t/assert_keys_are.t
new/Carp-Assert-More-1.24/t/assert_keys_are.t
--- old/Carp-Assert-More-1.20/t/assert_keys_are.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Carp-Assert-More-1.24/t/assert_keys_are.t 2020-10-07
05:07:41.000000000 +0200
@@ -0,0 +1,61 @@
+#!perl -Tw
+
+use warnings;
+use strict;
+
+use Test::More tests => 1;
+
+use Carp::Assert::More;
+
+use Test::Exception;
+
+subtest assert_keys_are => sub {
+ plan tests => 8;
+
+ my $monolith = {
+ depth => 1,
+ width => 4,
+ height => 9,
+ };
+ my $shaq = {
+ firstname => 'Shaquille',
+ lastname => 'O\'Neal',
+ height => 85,
+ };
+
+ my @object_keys = qw( height width depth );
+ my @person_keys = qw( firstname lastname height );
+
+ lives_ok( sub { assert_keys_are( $monolith, \@object_keys ) }, 'Monolith
object has valid keys' );
+ lives_ok( sub { assert_keys_are( $shaq, \@person_keys ) }, 'Shaq
object has valid keys' );
+ lives_ok( sub { assert_keys_are( {}, [] ) }, 'Empty hash + empty keys
works fine' );
+
+ throws_ok(
+ sub { assert_keys_are( $monolith, \@person_keys ) },
+ qr/Assertion.*failed!/,
+ 'Monolith fails on person keys'
+ );
+
+ throws_ok(
+ sub { assert_keys_are( $monolith, [@object_keys[0..1]] ) },
+ qr/Assertion.*failed/,
+ 'Hash has too many keys'
+ );
+ throws_ok(
+ sub { assert_keys_are( $monolith, [@object_keys, 'wavelength'] ) },
+ qr/Assertion.*failed/,
+ 'Hash has one key too many'
+ );
+ throws_ok(
+ sub { assert_keys_are( $monolith, [] ) },
+ qr/Assertion.*failed/,
+ 'Empty key list fails for non-empty object'
+ );
+ throws_ok(
+ sub { assert_keys_are( {}, \@object_keys ) },
+ qr/Assertion.*failed/,
+ 'Empty hash fails for non-empty key list'
+ );
+};
+
+exit 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Carp-Assert-More-1.20/t/test-coverage.t
new/Carp-Assert-More-1.24/t/test-coverage.t
--- old/Carp-Assert-More-1.20/t/test-coverage.t 2019-08-09 17:13:48.000000000
+0200
+++ new/Carp-Assert-More-1.24/t/test-coverage.t 2020-10-07 05:07:41.000000000
+0200
@@ -1,6 +1,6 @@
#!perl -Tw
-use Test::More tests => 34;
+use Test::More tests => 35;
use Carp::Assert::More;