locale.t: Add ability to output a message with 'ok'
authorKarl Williamson <public@khwilliamson.com>
Wed, 14 Dec 2011 04:20:12 +0000 (21:20 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 15 Dec 2011 23:14:52 +0000 (16:14 -0700)
locale.t uses its own custom TAP messages.  This changes the 'ok' sub
to accept another parameter, a test description to add to the TAP line.
And it changes the taint functions to produce a generic one of these

lib/locale.t

index c2bc3d1..79fce19 100644 (file)
@@ -1,5 +1,8 @@
 #!./perl -wT
 
+binmode STDOUT, ':utf8';
+binmode STDERR, ':utf8';
+
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
@@ -62,10 +65,13 @@ sub LC_ALL ();
 $a = 'abc %';
 
 sub ok {
-    my ($n, $result) = @_;
+    my ($n, $result, $message) = @_;
+    $message = "" unless defined $message;
 
     print 'not ' unless ($result);
-    print "ok $n\n";
+    print "ok $n";
+    print " $message";
+    print "\n";
 }
 
 # First we'll do a lot of taint checking for locales.
@@ -80,11 +86,11 @@ sub is_tainted { # hello, camel two.
 }
 
 sub check_taint ($$) {
-    ok $_[0], is_tainted($_[1]);
+    ok $_[0], is_tainted($_[1]), "verify that is tainted";
 }
 
 sub check_taint_not ($$) {
-    ok $_[0], not is_tainted($_[1]);
+    ok $_[0], (not is_tainted($_[1])), "verify that isn't tainted";
 }
 
 use locale;    # engage locale and therefore locale taint.