Skip to content

Commit fd141e4

Browse files
committed
Tweak t/e02_bool.t
1 parent 8d5d883 commit fd141e4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

t/e02_bool.t

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@ my $not_not_a_number_is_a_number = (
1717
($json->backend->isa('JSON::PP') && ($JSON::PP::Boolean::VERSION || $JSON::backportPP::Boolean::VERSION))
1818
) ? 1 : 0;
1919

20-
is($json->encode([!1]), '[""]');
20+
my $core_bool_support = JSON->backend->can("CORE_BOOL") && JSON->backend->CORE_BOOL ? 1 : 0;
21+
22+
is($json->encode([!1]), $core_bool_support ? '[false]' : '[""]');
2123
if ($not_not_a_number_is_a_number) {
22-
is($json->encode([!!2]), '[1]');
24+
is($json->encode([!!2]), $core_bool_support ? '[true]' : '[1]');
2325
} else {
2426
is($json->encode([!!2]), '["1"]');
2527
}
2628

27-
is($json->encode([ 'a' eq 'b' ]), '[""]');
29+
is($json->encode([ 'a' eq 'b' ]), $core_bool_support ? '[false]' : '[""]');
2830
if ($not_not_a_number_is_a_number) {
29-
is($json->encode([ 'a' eq 'a' ]), '[1]');
31+
is($json->encode([ 'a' eq 'a' ]), $core_bool_support ? '[true]' : '[1]');
3032
} else {
3133
is($json->encode([ 'a' eq 'a' ]), '["1"]');
3234
}

0 commit comments

Comments
 (0)