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.
  • And the best thing is that if you ever reintroduce that bug, you will recatch it as well.

    Test everything. Test your most basic assumptions. Once you write it, it's done, and will be in your employ forever.

    Here's some stuff I wrote yesterday that reads a tree structure of nodes from the DB and makes sure that there are no stray, unlinked nodes:

    #!/usr/bin/perl -w

    use strict;
    use Test::More tests=>5;
    use FLR::DB qw( :sqldo );

    my %nodes;
    my %children;
    my @tops;

    =pod

    This little baby looks at all the nodes

    --

    --
    xoa

    • How useful are you finding embedded POD in your tests? I've been of the opinion that good test names go a long way, but does a little documentation go even further?

      • This example is pretty uncommon, since usually the code behind the tests is pretty obvious. In this case, since I was building up trees and then deleting them recursively, I thought it warranted comments.

        I do always make sure that every test has a name, though. I hate seeing:

        ok 1
        ok 2
        ok 3
        not ok 4
        ok 5
        ok 6
        and then having to count down to test 4 in the code to see what it is
        --

        --
        xoa