locale.t: Add optional test name supplement
authorKarl Williamson <public@khwilliamson.com>
Fri, 7 Dec 2012 02:19:13 +0000 (19:19 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sun, 9 Dec 2012 16:47:19 +0000 (09:47 -0700)
This allows tests to have extra stuff passed in that will be printed as
part of the test results

lib/locale.t

index 26a7bd4..e75087f 100644 (file)
@@ -89,12 +89,16 @@ sub is_tainted { # hello, camel two.
     not eval { $dummy = join("", @_), kill 0; 1 }
 }
 
-sub check_taint ($) {
-    ok is_tainted($_[0]), "verify that is tainted";
+sub check_taint ($;$) {
+    my $message_tail = $_[1] // "";
+    $message_tail = ": $message_tail" if $message_tail;
+    ok is_tainted($_[0]), "verify that is tainted$message_tail";
 }
 
-sub check_taint_not ($) {
-    ok((not is_tainted($_[0])), "verify that isn't tainted");
+sub check_taint_not ($;$) {
+    my $message_tail = $_[1] // "";
+    $message_tail = ": $message_tail" if $message_tail;
+    ok((not is_tainted($_[0])), "verify that isn't tainted$message_tail");
 }
 
 use locale;    # engage locale and therefore locale taint.