- Test::Differences
- cmp_deeply
Test::Differences
Test::Differences provides UNIX-like diff output when strings are not matching.
examples/test-perl/t/test_differences.t
use strict; use warnings; use Test::More tests => 1; use Test::Differences; my @expected = ( 'This is a string', 'Another string', ); my @actual = @expected; $actual[0] .= 'x'; eq_or_diff \@actual, \@expected;
perl examples/test-perl/t/test_differences.t
1..1 not ok 1 # Failed test at t/test_differences.t line 15. # +----+------------------------+-----------------------+ # | Elt|Got |Expected | # +----+------------------------+-----------------------+ # | 0|[ |[ | # * 1| 'This is a stringx', | 'This is a string', * # | 2| 'Another string' | 'Another string' | # | 3|] |] | # +----+------------------------+-----------------------+ # Looks like you failed 1 test of 1.