t/Helper/CatalystUtils.t: test trim functionality

This commit is contained in:
Graham Christensen 2021-12-01 08:38:43 -08:00 committed by Cole Helbling
parent d56815cae6
commit 085b02e092

28
t/Helper/CatalystUtils.t Normal file
View file

@ -0,0 +1,28 @@
use strict;
use warnings;
use Setup;
use Test2::V0;
use Hydra::Helper::CatalystUtils;
subtest "trim" => sub {
my %values = (
"" => "",
"🌮" => '🌮',
" 🌮" => '🌮',
"🌮 " => '🌮',
" 🌮 " => '🌮',
"\n🌮 " => '🌮',
"\n\t🌮\n\n\t" => '🌮',
);
for my $input (keys %values) {
my $value = $values{$input};
is(trim($input), $value, "Trim the value: " . $input);
}
my $uninitialized;
is(trim($uninitialized), '', "Trimming an uninitialized value");
};
done_testing;