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.
  • 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    |trois     *
      # |   3|4    |4         |
      # *   4|5    |cinq      *
      # +----+-----+----------+
      not ok 2

      #   Failed test at test.t line 11.
      # Compared $data->[2]
      #    got : '3'
      # expect : 'trois'

      With Test::Differences, I can see and potentially fix all of the problems at once. I've used Test::Deep for the bag tests, but that's about it.

      Also, last night I decided to figure out which Test modules were the most popular. Out of almost 300 I found used in CPAN modules, here are the top ten:

        Test::More              44473
        Test::Exception          1380
        Test::Simple              731
        Test::Base                316
        Test::Builder::Tester     193
        Test::NoWarnings          174
        Test::Differences         150
        Test::MockObject          139
        Test::Deep                127
        Test::Warn                118

      Test::Deep certainly warrants more attention here.