Create a helper for dealing with nested attribute sets

This commit is contained in:
Graham Christensen
2021-03-17 11:53:00 -04:00
parent d62a2c1657
commit 88e0198a8e
4 changed files with 136 additions and 1 deletions

View File

@ -22,4 +22,23 @@ subtest "checking individual attribute set elements" => sub {
}
};
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;