File: boolean_copy.t

package info (click to toggle)
libbson-xs-perl 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,708 kB
  • sloc: ansic: 9,734; perl: 1,049; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 660 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use warnings;

use Test::More;
use Test::Fatal;
use lib 't/lib';
use lib 't/pvtlib';
use CleanEnv;

use BSON;
use boolean;

my $c = BSON->new;

# PERL-575 boolean values were references to each other, so if two were created
# identically, then changing one would change the other.

my $a = { "okay" => false, "name" => "fred0" };
my $b = { "okay" => false, "name" => "fred1" };

my $a_bin = $c->encode_one( $a );
my $b_bin = $c->encode_one( $b );

my @docs = ( map{ $c->decode_one( $_ ) } ( $a_bin, $b_bin ) );

is( exception { $_->{okay} = $_->{okay}->TO_JSON for @docs },
  undef, "replacing one boolean doesn't affect another" );

done_testing;