S2KNQCPB22URM7BLFSMADPWPQGBOZWMYHBPIW4N6PNEFVDUTYWWQC
2JJP76737U2JWJWQ6UDFEAQCGWRAQH46HC6OCIKWMB5QYRXF6DQQC
D5QIOJGPKQJIYBUCSC3MFJ3TXLPNZ2XMI37GXMFRVRFWWR2VMTFAC
LVJKRTIK5WOWWAZ454B4DCCGETOIQJK5TLOWMZVNY2B4AEGF2GMAC
UZENK33PYWZIWNJMLE2IIXKA6KOCGKGOWUMVBNXAYBOKT2H6ZT6AC
I42G2Z7PKDALZKM526VU253MZORF54KFJ3VNGXVE76LRH2RGNORQC
L5Z6CN7MHFGRL2QPLCVQJSDECT35EW52INUV5RVI4CXH2YSDJGNAC
FG4JZPWS76SM2UQ7CJWO54S7SXRWPZPK4ZBIGLOVHWSJTOSCZFOQC
PDZXZZPZX3GUJGYUNAKB5ISRNF3ED4K4I63XJA2GZQNGSTQNMPAAC
package Hydra::Helper::Escape;
use strict;
use base qw(Exporter);
our @EXPORT = qw(escapeString);
sub escapeString {
my ($s) = @_;
$s =~ s|\\|\\\\|g;
$s =~ s|\"|\\\"|g;
$s =~ s|\$|\\\$|g;
return "\"" . $s . "\"";
}
$res .= " name = ${\escape ($build->get_column('releasename') or $build->nixname)};\n";
$res .= " system = ${\escape $build->system};\n";
$res .= " name = ${\escapeString ($build->get_column('releasename') or $build->nixname)};\n";
$res .= " system = ${\escapeString $build->system};\n";
use strict;
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);
}
};
done_testing;