[Israel.pm] Using perl as unit-testing framework

Shlomi Fish shlomif at iglu.org.il
Mon Nov 23 01:44:31 PST 2009

On Monday 23 Nov 2009 01:34:50 Assaf Gordon wrote:
> Hello,
> I have a package of command line programs (written in c/c++) and I want to
>  add unit-testing to it. It uses the gnu autotools, and I'd like users to
>  be able to run "make check" to run the tests.
> I'm sure similar things have been done countless of times (probably using
>  Perl). Do you have any recommendation on where to start ?

I've implemented a set of TAP/Test::More-based tests here:


You can copy the appropriate code from the GNU Autotools-based setup. Just 
note that I'm planning on switching away from GNU-Autotools to a different 
installer (such as Module-Build or CMake) because I don't like GNU-Autotools 

> Important features are:
> 1. minimum end-user requirements (preferably - will not require them to
>  install modules with CPAN) 

Maybe you can bundle IPC::Run3 (like Gaal has suggested) or Test::Trap.

>  2. Set command line arguments and STDIN, check
>  STDOUT, STDERR and exitcode (and of course segfaults and signals). 

Test::Trap can do that.

>  3. relatively easy to implement

See how I implemented it.


	Shlomi Fish

> If the answer is RTFM, please point me to a good FM (for example, the main
>  wiki for TAP has a lot of information, except starting examples for just
>  two languages: C++ and PERL....
>  http://testanything.org/wiki/index.php/Testing_with_TAP )
> Thanks,
>   -gordon
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl

Shlomi Fish       http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://shlom.in/sussman

Chuck Norris read the entire English Wikipedia in 24 hours. Twice.

More information about the Perl mailing list