1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
|
Revision history for Perl extension Carp::Assert::More.
2.9.0 Wed Mar 5 22:27:28 CST 2025
[ENHANCEMENTS]
assert_arrayref_of() no longer requires the array to have at
least one element.
New assert_arrayref_nonempty_of() has the same behavior as
assert_arrayref_of(), but requires at least one element.
2.8.0 Fri Jan 3 12:03:58 CST 2025
[ENHANCEMENTS]
Added assert_regex().
2.7.0 Wed Dec 25 14:40:15 CST 2024
[ENHANCEMENTS]
Added assert_numeric_between() and assert_integer_between().
2.6.0 Sun Dec 22 23:37:00 CST 2024
[ENHANCEMENTS]
Add assert(), the same as assert() in Carp::Assert, as a
convenience.
Add assert_and(), assert_or() and assert_xor() for more helpful
stacktraces.
2.5.0 Fri Oct 25 14:46:06 CDT 2024
[ENHANCEMENTS]
Add assert_context_list() function.
Add assert_context_void() function.
2.4.0 Mon Mar 4 21:54:07 CST 2024
[ENHANCEMENTS]
New function assert_arrayref_all() calls an assertion function for every element in the array.
my $aref_of_counts = get_counts();
assert_arrayref_all( $aref, \&assert_positive_integer, 'Counts are positive' );
assert_context_scalar() now provides a default message of
"function_name must be called in scalar context".
assert_context_nonvoid() now provide a default message of
"function_name must not be called in void context".
2.3.0 Tue May 30 21:52:20 CDT 2023
[ENHANCEMENTS]
Added assert_arrayref_of() to verify that all of the elements
in an arrayref are of a given type. For example:
my $users = get_users();
assert_arrayref_of( $users, 'My::User' );
2.2.0 Sun Jan 29 20:23:59 CST 2023
[ENHANCEMENTS]
Added assert_cmp( $x, $op, $y [, $msg] ), analogous to cmp_ok in Test::More, so you can do
assert_cmp( $n, '>', 10 );
which will give better diagnostics than just
assert( $n > 10 );
Operators supported are: lt le gt ge == != > >= < <=
assert_all_keys_in() now lists all key failures in the message, not just the first one.
assert_keys_are() now lists all key failures in the message, not just the first one.
2.1.0 Mon Aug 15 19:54:27 CDT 2022
[ENHANCEMENTS]
Add diagnostic strings to the failures. For example:
assert_nonblank( [ 'foo' ], 'This should be nonblank' );
would fail with:
Assertion (This should be nonblank) failed!
but now fails with:
Assertion (This should be nonblank) failed!
Value is a reference to ARRAY.
Similar changes have been made to:
* assert_all_keys_in
* assert_keys_are
* assert_empty
* assert_nonempty
2.0.1 Fri Aug 13 11:57:15 CDT 2021
[FIXES]
assert_all_keys_in() mistakenly required a non-empty list of
keys to check.
[ENHANCEMENTS]
Sped up assert_isa_in(), assert_is().
2.0.0 Thu Aug 12 23:00::00 CDT 2021
[DIFFERENCES]
Now requires Perl 5.10 or higher. No longer requires Carp::Assert.
The numeric functions are more stringent now. If it expects
a number, then you need to pass a number. For example,
assert_nonnegative($x) would pass if $x was a non-numeric
string. Now it must be numeric.
assert_empty() and assert_nonempty() no longer gives a message
of "Not an array or hash reference". If you don't pass an array
or hash reference, the assertion will just fail with the message
passe3d in.
assert_aoh() and assert_datetime() no longer provide a default
message.
assert_in() is more strict. Each element of the target array
is checked to not be a reference.
assert_exists() and assert_lacks() are more strict. The list
of keys to check cannot be empty.
[ENHANCEMENTS]
Most of the functions are about twice as fast because of reduced
number of function calls internally.
Added assert_context_nonvoid() and assert_context_scalar()
to assert on how the executing function has been called.
assert_in() now lets you use undef as both the needle and one
of the values in the haystack.
1.26 Sat Dec 26 00:26:23 CST 2020
[ENHANCEMENTS]
Add assert_arrayref_nonempty().
Add assert_hashref_nonempty().
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.
1.18 Fri Jul 19 17:12:32 CDT 2019
[ENHANCEMENTS]
Added assert_aoh() for asserting an array of hashrefs.
1.16 Fri Aug 4 14:18:51 CDT 2017
[ENHANCEMENTS]
Added the following functions:
* assert_numeric( $n )
* assert_all_keys_in( \%hash, \@keylist )
* assert_empty( [\%hash|\@list] )
* assert_coderef( $ref )
* assert_isa_in( $ref, \@class_list )
Thanks to Eric A. Zarko for some of them. The rest were migrated
from a private code project.
Renamed assert_listref() to assert_arrayref(), but keep
assert_listref() as backward compatibility. assert_listref()
may go away in the future.
[DOCUMENTATION]
Fixed a goof in the assert_integer() docs. Thanks, Randy Lauen.
1.14 Wed Oct 31 11:37:04 CDT 2012
[ENHANCEMENTS]
Added assert_undefined() for Ben Hengst.
Added assert_unlike().
[FIXES]
assert_nonblank() wasn't using the correct message. Thanks to
Leland Johnson.
assert_nonempty() wouldn't work on blessed arrays and refs.
Now it will.
1.12 Oct 14 2005
[ENHANCEMENTS]
* Added assert_nonnegative() and assert_nonnegative_integer().
* Added assert_lacks(). Thanks to Bob Diss.
1.10 Wed Feb 16 12:52:16 CST 2005
[FIXES]
* Fixed assert_positive_integer() to not pass "14.".
1.08 Wed Nov 24 11:44:34 CST 2004
[ENHANCEMENTS]
* Added assert_is() and assert_isnt()
* Organized the functions into logical groupings.
[INTERNALS]
* Now requires Test::Exception.
* Added t/pod.t and t/pod-coverage.t
1.06 Sat Oct 30 23:50:45 CDT 2004
* No functionality changes. Just added a Copyright notice to
so we can put it in Debian.
1.04 Mon Oct 18 10:21:37 CDT 2004
[ENHANCEMENTS]
* assert_isa() is now aware of subclasses.
[FIXES]
* $names weren't getting passed to sub-assertions. Now they are.
[DOCUMENTATION]
* Documentation fix.
This is the "all thanks to Allard Hoeve" release.
1.02 Tue Oct 5 17:31:56 CDT 2004
[ENHANCEMENTS]
* Added assert_hashref() and assert_listref(). Thanks to Dan
Friedman.
1.00 Wed Sep 22 10:14:28 CDT 2004
* First real official version. I'm not sure what's different
between this and 0.04.
* Added a bunch of new assert_* functions. Thanks David
Storrs and Pete Krawczyk.
0.04 August 21, 2002
- Added assert_integer
- Added assert_nonzero
- Added assert_nonzero_integer
- Added assert_exists
0.03 August 15, 2002
- Added assert_fail
0.02 August 8, 2002
- Added assert_nonblank and assert_nonref
0.01 August 8, 2002
- Original version, stolen from Carp::Assert
|