2021-12-01 16:38:43 +00:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Setup;
|
|
|
|
use Test2::V0;
|
|
|
|
use Hydra::Helper::CatalystUtils;
|
|
|
|
|
2022-01-11 16:48:02 +00:00
|
|
|
my $ctx = test_context();
|
|
|
|
|
|
|
|
my $builds = $ctx->makeAndEvaluateJobset(
|
|
|
|
expression => "basic.nix",
|
|
|
|
build => 1
|
|
|
|
);
|
|
|
|
|
2021-12-01 16:38:43 +00:00
|
|
|
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");
|
|
|
|
};
|
|
|
|
|
2022-01-11 16:48:02 +00:00
|
|
|
subtest "showJobName" => sub {
|
|
|
|
ok(showJobName($builds->{"empty_dir"}), "showJobName succeeds");
|
|
|
|
};
|
|
|
|
|
2021-12-01 16:38:43 +00:00
|
|
|
done_testing;
|