Slash Boxes
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

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

  (email not shown publicly)
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Wednesday June 08, 2005
08:21 PM

recurisve "make test"

[ #25107 ]

Shawn Sorichetti, God bless his soul, gave me what I'd long wanted: a sample test script for testing Rubric::WebApp using HTTP::Server::Simple and Test::WWW::Mechanize. It wasn't the Mech stuff I was worried about, but the HSS. Shawn gave me two little files to drop in place and see the whole thing work. Now I am set to start testing all kinds of crap!

I got to a point where I wanted to start organizing my test files into directories, and I remembered that while prove can do recursive test files with -r, MakeMaker doesn't use Harness that way by default. Neither Shawn nor Andy had a ready-made solution, so I got a really weird urge to do something silly, and wrote this:

test => {
  TESTS => join " ", sub {
    my $w; $w = sub { map { -d $_ ? $w->($_) : /\.t\Z/ ? $_ : () } grep { ! /^\./ } <$_[0]/*> };

That incantation will now live in the WriteMakefile calls of my more complex distributions, and I will smile every time I see it.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Is that missing something? Unless I misinterpret the intent, shouldn’t there be a call that reads a directory’s content somewhere?

    And wouldn’t a do {} block do in place of the outer sub{}->()? You’re not passing any parameters (which is when that bit of voodoo is useful), after all.

    • A "do" would be better, yes. The something to read the directory content is apparently being eaten by slashcode/html. After the grep is "$_[0]*" in a diamond glob operator.
      • Ah. Try using <ecode></ecode> tags for blocks of code, or otherwise, use &lt; for literal opening angle brackets.

        • Aha! Yes, thanks. I don't know why I forgot to use ecode!

          I should probably just use File::Find, but I like this silly hack.