52b0c8d24f4834a1aa804260ae55e23dad86f97f
[kivitendo-erp.git] / t / helper / trim.t
1 use Test::More tests => 11;
2
3 use strict;
4 use utf8;
5
6 use lib 't';
7
8 use SL::Util qw(trim);
9
10 is(trim("hello"),               "hello",         "hello");
11 is(trim("hello "),              "hello",         "hello ");
12 is(trim(" hello"),              "hello",         " hello");
13 is(trim(" hello "),             "hello",         " hello ");
14 is(trim(" h el lo "),           "h el lo",       " h el lo ");
15 is(trim("\n\t\rh\nello"),       "h\nello",       "line feed, horizontal tab, carriage return; line feed within word");
16 is(trim("\x{a0}h\nello"),       "h\nello",       "non-breaking space");
17 is(trim("h\nello\n\t\r"),       "h\nello",       "line feed, horizontal tab, carriage return; line feed within word");
18 is(trim("h\nello\x{a0}"),       "h\nello",       "non-breaking space");
19 is(trim("h\ne\x{a0}llo\x{a0}"), "h\ne\x{a0}llo", "non-breaking space within word");
20 is(trim(undef),                 undef,           "undef");