Add names to the tests
More advantages of Test::Simple - names of the tests.
So Test::Simple module makes our life a bit more simple in that we don't have to write our testing expression. In addition this new "ok" function can actually do some more. It can get two arguments. The first one indicates success or failure of the test as explained earlier. The second one is a string which is the name of the test. When running a test these additional names get printed on the same line where the counter and the "ok" or "not ok" is printed. If the names were written carefully, then they can provide an immediate hint on what went wrong. Sometimes you won't even need to look at the test script itself, right from this comment you'll know where to look for the bug.
use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; use MyTools; use Test::Simple tests => 3; ok(sum(1, 1)==2, '1+1'); ok(sum(2, 2)==4, '2+2'); ok(sum(2, 2, 2)==6, '2+2+2');
1..3 ok 1 - 1+1 ok 2 - 2+2 not ok 3 - 2+2+2 # Failed test '2+2+2' # at examples/perl/tests/t14.pl line 12. # Looks like you failed 1 test of 3.