X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44..53593baa211863fbf66540cf1bcc36c8fb37257f:/t/helper/trim.t diff --git a/t/helper/trim.t b/t/helper/trim.t new file mode 100644 index 000000000..52b0c8d24 --- /dev/null +++ b/t/helper/trim.t @@ -0,0 +1,20 @@ +use Test::More tests => 11; + +use strict; +use utf8; + +use lib 't'; + +use SL::Util qw(trim); + +is(trim("hello"), "hello", "hello"); +is(trim("hello "), "hello", "hello "); +is(trim(" hello"), "hello", " hello"); +is(trim(" hello "), "hello", " hello "); +is(trim(" h el lo "), "h el lo", " h el lo "); +is(trim("\n\t\rh\nello"), "h\nello", "line feed, horizontal tab, carriage return; line feed within word"); +is(trim("\x{a0}h\nello"), "h\nello", "non-breaking space"); +is(trim("h\nello\n\t\r"), "h\nello", "line feed, horizontal tab, carriage return; line feed within word"); +is(trim("h\nello\x{a0}"), "h\nello", "non-breaking space"); +is(trim("h\ne\x{a0}llo\x{a0}"), "h\ne\x{a0}llo", "non-breaking space within word"); +is(trim(undef), undef, "undef");