From 085b02e092b5984ad7d1501830933d349a293cc1 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 1 Dec 2021 08:38:43 -0800 Subject: [PATCH] t/Helper/CatalystUtils.t: test trim functionality --- t/Helper/CatalystUtils.t | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 t/Helper/CatalystUtils.t diff --git a/t/Helper/CatalystUtils.t b/t/Helper/CatalystUtils.t new file mode 100644 index 00000000..26f8dcde --- /dev/null +++ b/t/Helper/CatalystUtils.t @@ -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;