.github
datadog
doc
examples
foreman
src
t
Helper
Hydra
Config
Controller
Event
Helper
BuildDiff.t
CatalystUtils.t
Nix.t
attributeset.t
escape.t
Plugin
Schema
View
Event.t
Math.t
PostgresListener.t
TaskDispatcher.t
evaluator
input-types
jobs
lib
queue-runner
scripts
Makefile.am
api-test.t
build-products.t
perlcritic.pl
s3-backup-test.config
s3-backup-test.pl
setup-notifications-jobset.pl
test.pl
.editorconfig
.gitignore
.perlcriticrc
.yath.rc
COPYING
INSTALL
Makefile.am
Procfile
README.md
configure.ac
default.nix
flake.lock
flake.nix
hydra-api.yaml
hydra-module.nix
shell.nix
version.txt
t/ had lots of directories and files mirroring src/lib/Hydra. This moves those files under t/Hydra
46 lines
1.1 KiB
Perl
46 lines
1.1 KiB
Perl
use strict;
|
|
use warnings;
|
|
use Setup;
|
|
use Data::Dumper;
|
|
use Test2::V0;
|
|
use Hydra::Helper::Escape;
|
|
|
|
subtest "checking individual attribute set elements" => sub {
|
|
my %values = (
|
|
"" => '""',
|
|
"." => '"."',
|
|
"foobar" => '"foobar"',
|
|
"foo.bar" => '"foo.bar"',
|
|
"🌮" => '"🌮"',
|
|
'foo"bar' => '"foo\"bar"',
|
|
'foo\\bar' => '"foo\\\\bar"',
|
|
'$bar' => '"\\$bar"',
|
|
);
|
|
|
|
for my $input (keys %values) {
|
|
my $value = $values{$input};
|
|
is(escapeString($input), $value, "Escaping the value: " . $input);
|
|
}
|
|
};
|
|
|
|
subtest "escaping path components of a nested attribute" => sub {
|
|
my %values = (
|
|
"" => '""',
|
|
"." => '"".""',
|
|
"...." => '""."".""."".""',
|
|
"foobar" => '"foobar"',
|
|
"foo.bar" => '"foo"."bar"',
|
|
"🌮" => '"🌮"',
|
|
'foo"bar' => '"foo\"bar"',
|
|
'foo\\bar' => '"foo\\\\bar"',
|
|
'$bar' => '"\\$bar"',
|
|
);
|
|
|
|
for my $input (keys %values) {
|
|
my $value = $values{$input};
|
|
is(escapeAttributePath($input), $value, "Escaping the attribute path: " . $input);
|
|
}
|
|
};
|
|
|
|
done_testing;
|