Test::Differences Now Supports Alternate Diff Styles

Ovid on 2008-08-02T12:11:42

The new Test::Differences, 0.49_02 should be on the CPAN soon. It now supports all of the diff styles available in Text::Diff. This eliminates all of the remaining RT tickets in the queue.

use Test::More 'no_plan';
use Test::Differences;

my $long_string = join '' => 1..40;

TODO: {
    local $TODO = 'Testing diff styles';

    # this is the default and does not need to explicitly set unless you need
    # to reset it back from another diff type
    table_diff;
    eq_or_diff $long_string, "-$long_string", 'table diff';

    unified_diff;
    eq_or_diff $long_string, "-$long_string", 'unified diff';

    context_diff;
    eq_or_diff $long_string, "-$long_string", 'context diff';

    oldstyle_diff;
    eq_or_diff $long_string, "-$long_string", 'oldstyle diff';
}

I don't particularly care for the other diff styles, but when you have a 60 character string forcing the table to wrap, they can come in handy.