aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-03-27 10:32:11 +0100
committerStruan Donald <struan@exo.org.uk>2012-03-27 10:32:11 +0100
commita2fd089c48ce36b3e015845256fa688a27ff1572 (patch)
tree7a515a48153c855340ba772f046a89e3e3516cf4 /t
parentf682af8e012def2ee12c2e2607cad7b4fc9f2161 (diff)
parenteba1039023271bac6178776f9e7d48b79a1c43e3 (diff)
Merge remote-tracking branch 'origin/master' into bromley
Diffstat (limited to 't')
-rw-r--r--t/utils.t25
1 files changed, 24 insertions, 1 deletions
diff --git a/t/utils.t b/t/utils.t
index 385c482ed..8ff9266fd 100644
--- a/t/utils.t
+++ b/t/utils.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More;
use FindBin;
use lib "$FindBin::Bin/../perllib";
@@ -39,3 +39,26 @@ foreach my $test (@convert_en_to_latlon_tests) {
[ $lat, $lon ], #
"convert ($e,$n) to ($lat,$lon)";
}
+
+my @cleanup_tests = (
+ [ 'dog shit', 'Dog poo', 'dog poo' ],
+ [ 'dog shit', 'Dog poo', 'with spaces' ],
+ [ 'dog shite', 'Dog poo', 'with extra e' ],
+ [ 'there is dog shit here', 'There is dog poo here', 'with surrounding text' ],
+ [ 'portacabin', '[portable cabin]', 'cabin' ],
+ [ 'portaloo', '[portable loo]', 'loo' ],
+ [ 'porta loo', '[portable loo]', 'with spaces' ],
+ [ ' this is a report ', 'This is a report', 'leading and trailing spaces' ],
+ [ 'This is a report ', 'This is a report', 'spaces in the middle' ],
+ [ 'I AM SHOUTING AT YOU', 'I am shouting at you', 'all shouting' ],
+ [ 'I am EMPHASISING something', 'I am EMPHASISING something', 'some shouting' ],
+ [ "This has new\n\n\nlines in it", 'This has new Lines in it', 'no new lines' ],
+);
+
+foreach my $test ( @cleanup_tests ) {
+ is Utils::cleanup_text( $test->[0]), $test->[1], $test->[2];
+}
+
+is Utils::cleanup_text( "This has new\n\n\nlines in it", { allow_multiline => 1 } ), "This has new\n\nLines in it", 'new lines allowed';
+
+done_testing();