Alec the Geek

Reflections on software and related things from an older geek

  • Twitter Ramplings

  • My Bookmarks

  • RSS Alec’s GitHub

    • An error has occurred; the feed is probably down. Try again later.

More on testing Perl applications

Posted by Alec The Geek on 9 January 2007

A few weeks ago I said

As far as I can tell all, of the current CPAN testing frameworks are designed to test Perl Modules (.pm files). Because of this they are designed to be consumers of the services provided by the modules under test.

Testing Applications and Suites using Perl and TAP « Alec the Geek

It turns out of course that the test framework can be used with a Perl application. It is nessasry to imbed the tests directly in the code. The following simple, but complete, example is taken from Perl Testing: A Developers’s Notebook.

#!perl
use strict;
use warnings;

use Test::Simple tests =>1;

sub hello_world
{
return "Hello, world!";
}

ok( hello_world( ) eq "Hello, world!" );

Blogged with Flock

About these ads

Sorry, the comment form is closed at this time.

 
Follow

Get every new post delivered to your Inbox.

Join 272 other followers

%d bloggers like this: