http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/
-The list is also archived under the usenet group name
-C<perl.porters-gw> at:
-
- http://www.deja.com/
-
List subscribers (the porters themselves) come in several flavours.
Some are quiet curious lurkers, who rarely pitch in and instead watch
the ongoing development to ensure they're forewarned of new changes or
my $test = 1;
sub ok {
- my($ok) = @_;
- print "not " unless $ok;
- print "ok $test\n";
+ my($ok, $name) = @_;
+
+ # You have to do it this way or VMS will get confused.
+ print $ok ? "ok $test - $name\n" : "not ok $test - $name\n";
+
+ printf "# Failed test at line %d\n", (caller)[2] unless $ok;
+
$test++;
return $ok;
}
we can write the (somewhat) more sensible:
- ok( "1.20.300.4000" eq sprintf "%vd", pack("U*",1,20,300,4000) );
+ ok( "1.20.300.4000" eq sprintf "%vd", pack("U*",1,20,300,4000),
+ "U* produces unicode" );
Now we'll test that we got that space-at-the-beginning business right:
- ok( "1.20.300.4000" eq sprintf "%vd", pack(" U*",1,20,300,4000) );
+ ok( "1.20.300.4000" eq sprintf "%vd", pack(" U*",1,20,300,4000),
+ " with spaces at the beginning" );
And finally we'll test that we don't make Unicode strings if C<U> is B<not>
the first active format:
- ok( v1.20.300.4000 ne sprintf "%vd", pack("C0U*",1,20,300,4000) );
+ ok( v1.20.300.4000 ne sprintf "%vd", pack("C0U*",1,20,300,4000),
+ "U* not first isn't unicode" );
Mustn't forget to change the number of tests which appears at the top, or
else the automated tester will get confused: