JSON -> JSON::MaybeXS

This commit is contained in:
Graham Christensen
2021-10-19 22:53:39 -04:00
parent d16c57e5f1
commit 7dcf6a01c6
31 changed files with 57 additions and 57 deletions

View File

@ -1,7 +1,7 @@
use strict;
use warnings;
use Setup;
use JSON qw(decode_json encode_json);
use JSON::MaybeXS qw(decode_json encode_json);
use Data::Dumper;
use URI;
my %ctx = test_init();

View File

@ -4,7 +4,7 @@ use warnings;
use Setup;
use IO::Uncompress::Bunzip2 qw(bunzip2);
use Archive::Tar;
use JSON qw(decode_json);
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
my %ctx = test_init(
use_external_destination_store => 0

View File

@ -2,7 +2,7 @@ use feature 'unicode_strings';
use strict;
use warnings;
use Setup;
use JSON qw(decode_json encode_json);
use JSON::MaybeXS qw(decode_json encode_json);
my %ctx = test_init();
@ -47,7 +47,7 @@ subtest 'Create new jobset "job" as flake type' => sub {
Cookie => $cookie,
Content => encode_json({
enabled => 2,
visible => JSON::true,
visible => JSON::MaybeXS::true,
name => "job",
type => 1,
description => "test jobset",
@ -72,12 +72,12 @@ subtest 'Read newly-created jobset "job"' => sub {
description => "test jobset",
emailoverride => "",
enabled => 2,
enableemail => JSON::false,
enableemail => JSON::MaybeXS::false,
errortime => undef,
errormsg => "",
fetcherrormsg => "",
flake => "github:nixos/nix",
visible => JSON::true,
visible => JSON::MaybeXS::true,
inputs => {},
keepnr => 3,
lastcheckedtime => undef,
@ -100,7 +100,7 @@ subtest 'Update jobset "job" to legacy type' => sub {
Cookie => $cookie,
Content => encode_json({
enabled => 3,
visible => JSON::true,
visible => JSON::MaybeXS::true,
name => "job",
type => 0,
nixexprinput => "ofborg",
@ -130,17 +130,17 @@ subtest 'Update jobset "job" to legacy type' => sub {
description => "test jobset",
emailoverride => "",
enabled => 3,
enableemail => JSON::false,
enableemail => JSON::MaybeXS::false,
errortime => undef,
errormsg => "",
fetcherrormsg => "",
flake => "",
visible => JSON::true,
visible => JSON::MaybeXS::true,
inputs => {
ofborg => {
name => "ofborg",
type => "git",
emailresponsible => JSON::false,
emailresponsible => JSON::MaybeXS::false,
value => "https://github.com/NixOS/ofborg.git released"
}
},
@ -165,7 +165,7 @@ subtest 'Update jobset "job" to have an invalid input type' => sub {
Cookie => $cookie,
Content => encode_json({
enabled => 3,
visible => JSON::true,
visible => JSON::MaybeXS::true,
name => "job",
type => 0,
nixexprinput => "ofborg",

View File

@ -2,7 +2,7 @@ use feature 'unicode_strings';
use strict;
use warnings;
use Setup;
use JSON qw(decode_json encode_json);
use JSON::MaybeXS qw(decode_json encode_json);
my %ctx = test_init();

View File

@ -2,7 +2,7 @@ use feature 'unicode_strings';
use strict;
use warnings;
use Setup;
use JSON qw(decode_json encode_json);
use JSON::MaybeXS qw(decode_json encode_json);
my %ctx = test_init();
@ -45,8 +45,8 @@ subtest "Read project 'tests'" => sub {
is(decode_json($projectinfo->content), {
description => "",
displayname => "Tests",
enabled => JSON::true,
hidden => JSON::false,
enabled => JSON::MaybeXS::true,
hidden => JSON::MaybeXS::false,
homepage => "",
jobsets => [],
name => "tests",
@ -61,8 +61,8 @@ subtest "Transitioning from declarative project to normal" => sub {
Content_Type => 'application/json',
Cookie => $cookie,
Content => encode_json({
enabled => JSON::true,
visible => JSON::true,
enabled => JSON::MaybeXS::true,
visible => JSON::MaybeXS::true,
name => "tests",
displayname => "Tests",
declarative => {
@ -84,8 +84,8 @@ subtest "Transitioning from declarative project to normal" => sub {
is(decode_json($projectinfo->content), {
description => "",
displayname => "Tests",
enabled => JSON::true,
hidden => JSON::false,
enabled => JSON::MaybeXS::true,
hidden => JSON::MaybeXS::false,
homepage => "",
jobsets => [".jobsets"],
name => "tests",
@ -104,8 +104,8 @@ subtest "Transitioning from declarative project to normal" => sub {
Content_Type => 'application/json',
Cookie => $cookie,
Content => encode_json({
enabled => JSON::true,
visible => JSON::true,
enabled => JSON::MaybeXS::true,
visible => JSON::MaybeXS::true,
name => "tests",
displayname => "Tests",
declarative => {
@ -127,8 +127,8 @@ subtest "Transitioning from declarative project to normal" => sub {
is(decode_json($projectinfo->content), {
description => "",
displayname => "Tests",
enabled => JSON::true,
hidden => JSON::false,
enabled => JSON::MaybeXS::true,
hidden => JSON::MaybeXS::false,
homepage => "",
jobsets => [],
name => "tests",

View File

@ -1,7 +1,7 @@
use strict;
use warnings;
use Setup;
use JSON;
use JSON::MaybeXS;
use File::Copy;
my %ctx = test_init(

View File

@ -1,5 +1,6 @@
use strict;
use warnings;
use JSON::MaybeXS;
use Setup;
my %ctx = test_init(
@ -44,7 +45,7 @@ subtest "Validate the top level fields match" => sub {
is($dat->{build}, $build->id, "The build event matches our expected ID.");
is($dat->{buildStatus}, 0, "The build status matches.");
is($dat->{event}, "buildFinished", "The build event matches.");
is($dat->{finished}, JSON::true, "The build finished.");
is($dat->{finished}, JSON::MaybeXS::true, "The build finished.");
is($dat->{project}, "tests", "The project matches.");
is($dat->{jobset}, "basic", "The jobset matches.");
is($dat->{job}, "metrics", "The job matches.");

View File

@ -1,7 +1,7 @@
use feature 'unicode_strings';
use strict;
use warnings;
use JSON;
use JSON::MaybeXS;
use Setup;
my %ctx = test_init(

View File

@ -1,7 +1,7 @@
use feature 'unicode_strings';
use strict;
use warnings;
use JSON;
use JSON::MaybeXS;
use Setup;
my $binarycachedir = File::Temp->newdir();

View File

@ -1,7 +1,7 @@
use strict;
use warnings;
use LWP::UserAgent;
use JSON;
use JSON::MaybeXS;
my $ua = LWP::UserAgent->new;
$ua->cookie_jar({});