Branch: refs/heads/blead
Home: https://github.com/Perl/perl5
Commit: b135e9358aa994456ec32ccfe7a73e685f598797
https://github.com/Perl/perl5/commit/b135e9358aa994456ec32ccfe7a73e685f598797
Author: Michiel Beijen <[email protected]>
Date: 2021-12-24 (Fri, 24 Dec 2021)
Changed paths:
M ext/Hash-Util-FieldHash/t/02_function.t
M ext/Hash-Util-FieldHash/t/11_hashassign.t
M ext/Pod-Functions/t/Functions.t
M ext/XS-APItest/t/push.t
M lib/Benchmark.t
M lib/DB.t
Log Message:
-----------
use is_deeply instead of eq_ Test::More functions
the eq_set, eq_hash, and eq_array functions in Test::More are
discouraged to use, and is_deeply is recommended. Ref:
https://metacpan.org/pod/Test::More#Discouraged-comparison-functions
The reason for this is that, if the tests fail, is_deeply has much
better diagnostics.
The other thing is that is_deeply is a test function directly, where
eq_hash and such need to be wrapped inside ok(). This is easy to forget
-- proof of this is in Benchmark.t, where we had this code, that did not
test anything:
eq_set([keys %$got], [qw(Foo Bar Baz)], 'should be exactly three objects');
It is now replaced by:
is_deeply([sort keys %$got], [sort qw(Foo Bar Baz)], 'should be exactly
three objects');
this commit replaces all usage of eq_set, eq_hash, and eq_array in lib/
and ext/ for tests that use Test::More.
One small exception is where a negated test is used; Test::More does not
have is_not_deeply() or such. Test2 has `isnt()` for this, but that is
not in core. In those cases, we still keep using the eq_ operators.