Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Ovid,

    Thanks for posting this. In 2005 I provided a patch for an explain() equivalent to Test::More, but it was never added:

    http://rt.cpan.org/Public/Bug/Display.html?id=14764 [cpan.org]

    It's such a sensible, helpful feature, I don't understand why it remains a feature which people continue to have to rediscover and patch themselves.

    • It's getting to the point where I'm thinking about just releasing a custom Test::More::Extra (or something) to handle this stuff. The problem is figuring out which test modules are the most common. Just choosing mine seems a bit cheeky.

  • I've tried to make this approach work. Here's the problem in a nutshell:

    $ perl -wle 'use OurMore "no_plan";  is 23, 42'
    not ok 1
    #   Failed test at -e line 1.
    #          got: '23'
    #     expected: '42'
    1..1
    # Looks like you failed 1 test of 1.

    $ perl -wle 'use OurMore "fail", "no_plan";  is 23, 42'
    not ok 1
    #   Failed test at /usr/local/perl/5.8.8/lib/Test/More.pm line 329.
    Test failed.  Halting at OurMore.pm line 44.
    1..1

  • I'm curious. Why do you prefer Test::Differences vs Test::Deep? Is it better diagnostics for failing tests, speed, personal preference, or something else altogether?
    • I just added Test::Deep. Consider the code:

      use Our::Test::More 'no_plan';
      my ( $foo, $bar ) = ( [qw/1 2 3 4 5/], [qw/1 2 trois 4 cinq/] );
      eq_or_diff $foo, $bar;
      cmp_deeply $foo, $bar;

      Consider the output:

      #   Failed test at test.t line 10.
      # +----+-----+----------+
      # | Elt|Got  |Expected  |
      # +----+-----+----------+
      # |   0|1    |1         |
      # |   1|2    |2         |
      # *   2|3    |