From d566d0db8cf4b2ea118bab571f973ee07916fd8c Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 16 Nov 2007 05:16:44 +0000 Subject: [PATCH] add a test for makeArrayTabSafe and add comments to WebGUI::Utility --- lib/WebGUI/Utility.pm | 3 ++- t/Utility.t | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Utility.pm b/lib/WebGUI/Utility.pm index f243334a3..5786416ea 100644 --- a/lib/WebGUI/Utility.pm +++ b/lib/WebGUI/Utility.pm @@ -225,7 +225,8 @@ Searches through an array looking for tabs and replaces them with four spaces. A =head3 array - A reference to the array to look through. + A reference to the array to look through. The array itself is modified, rather than + returning useful data. =cut diff --git a/t/Utility.t b/t/Utility.t index ece530961..e6145d50c 100644 --- a/t/Utility.t +++ b/t/Utility.t @@ -17,7 +17,8 @@ use Tie::IxHash; use WebGUI::Test; use WebGUI::Session; -use Test::More tests => 43; # increment this value for each test you create +use Test::More tests => 44; # increment this value for each test you create +use Test::Deep; my $session = WebGUI::Test->session; @@ -77,6 +78,15 @@ is( 'makeCommaSafe(): clearing tabs, newlines and carriage returns' ); +# makeArrayTabSafe -- modifies an array in place +my $tabbedArray = ["this\tthat", "these\nthose"]; +WebGUI::Utility::makeArrayTabSafe($tabbedArray); +cmp_deeply( + $tabbedArray, + ["this that", "these those"], + 'makeArrayTabSafe' +); + # randint my $number = WebGUI::Utility::randint(50,75); ok($number >= 50 && $number <= 75, 'randint()');