зеркало из https://github.com/microsoft/STL.git
Fix internal Perl script for Standard Library Header Units test coverage (#5056)
This commit is contained in:
Родитель
645cac9cad
Коммит
f70b8859c2
|
@ -6,11 +6,12 @@ use warnings;
|
|||
|
||||
use JSON::PP;
|
||||
use Run;
|
||||
use Try::Tiny;
|
||||
|
||||
sub readFile
|
||||
{
|
||||
my $filename = $_[0];
|
||||
open(my $handle, "<", $filename) or die("Couldn't open $filename: $!");
|
||||
open(my $handle, "<", $filename) or Run::PrintError(__FILE__, __LINE__, "Couldn't open $filename: $!");
|
||||
read($handle, my $string, -s $handle);
|
||||
return $string;
|
||||
}
|
||||
|
@ -19,14 +20,26 @@ sub loadJson
|
|||
{
|
||||
my $filename = $_[0];
|
||||
my $jsonStr = readFile($filename);
|
||||
return JSON::PP->new->utf8->decode($jsonStr);
|
||||
my $decoded = "";
|
||||
try {
|
||||
$decoded = JSON::PP->new->utf8->decode($jsonStr);
|
||||
} catch {
|
||||
Run::PrintError(__FILE__, __LINE__, "Caught exception in loadJson.");
|
||||
};
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
sub loadJsonWithComments
|
||||
{
|
||||
my $filename = $_[0];
|
||||
my $jsonStr = readFile($filename);
|
||||
return JSON::PP->new->relaxed->utf8->decode($jsonStr);
|
||||
my $decoded = "";
|
||||
try {
|
||||
$decoded = JSON::PP->new->relaxed->utf8->decode($jsonStr);
|
||||
} catch {
|
||||
Run::PrintError(__FILE__, __LINE__, "Caught exception in loadJsonWithComments.");
|
||||
};
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
sub getAllHeaders
|
||||
|
|
Загрузка…
Ссылка в новой задаче