Test reviews

cpanratings
 

RSS | Module Info | Add a review of Test

Test (1.25) *

As Dan noted, this module's ok(...) function is inconsistent and badly designed. This module is no longer recommended and you should use Test::More instead, which is better in any way.

(I've written a script to convert Test.pm-based scripts to Test::More, which might help you. You can find it on my home-site.)

Test (1.25) ***

Quick, tell what this does:

ok $d, 'valid diff';

If you answered "passes if $d evaluates to true, and sets the test name to 'a valid diff'", you're mistaken. The invocation will actually compare $d with the string 'valid diff'.

The problem is that ok() can be invoked with up to 3 parameters, and only the 3-parameter form allows you to specify a test name.

I prefer Test::Simple's (or Test::More's) interface, where it's clear that

ok $a, $b;

means that $a is the expression to evaluate and $b is the optional test name.