line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1587
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package KiokuDB::Test::Fixture::Binary; |
6
|
2
|
|
|
2
|
|
82
|
use Moose; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
14
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
10064
|
use Encode; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
154
|
|
9
|
2
|
|
|
2
|
|
9
|
use Test::More; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
17
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
551
|
use KiokuDB::Test::Person; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
34
|
|
12
|
2
|
|
|
2
|
|
8
|
use KiokuDB::Test::Employee; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
31
|
|
13
|
2
|
|
|
2
|
|
10
|
use KiokuDB::Test::Company; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
46
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
7
|
use namespace::clean -except => 'meta'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
17
|
|
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
855
|
use constant required_backend_roles => qw(BinarySafe); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
680
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
with qw(KiokuDB::Test::Fixture) => { excludes => 'required_backend_roles' }; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $utf8 = "×—×™×™×"; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
utf8::encode($utf8); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $bytes = pack("C*", 39, 233, 120, 20, 40, 150, 0, 0, 0, 0, 0, 210, 211, 222, 1 ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub create { |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return ( |
30
|
17
|
|
|
17
|
0
|
556
|
KiokuDB::Test::Person->new( |
31
|
|
|
|
|
|
|
binary => $utf8, |
32
|
|
|
|
|
|
|
), |
33
|
|
|
|
|
|
|
KiokuDB::Test::Person->new( |
34
|
|
|
|
|
|
|
binary => $bytes, |
35
|
|
|
|
|
|
|
), |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub verify { |
40
|
17
|
|
|
17
|
0
|
40
|
my $self = shift; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$self->txn_lives(sub { |
43
|
17
|
|
|
17
|
|
32
|
my ( $enc, $bin ) = $self->lookup_ok( @{ $self->populate_ids } ); |
|
17
|
|
|
|
|
505
|
|
44
|
|
|
|
|
|
|
|
45
|
17
|
|
|
|
|
123
|
isa_ok( $enc, "KiokuDB::Test::Person" ); |
46
|
17
|
|
|
|
|
5963
|
isa_ok( $bin, "KiokuDB::Test::Person" ); |
47
|
|
|
|
|
|
|
|
48
|
17
|
|
|
|
|
6572
|
ok( !Encode::is_utf8($enc->binary), "preserved utf8 bytes" ); |
49
|
17
|
|
|
|
|
5895
|
my $enc_decoded = Encode::decode( utf8 => $enc->binary ); |
50
|
17
|
|
|
|
|
882
|
ok( Encode::is_utf8($enc_decoded), "decoded cleanly" ); |
51
|
17
|
|
|
|
|
5155
|
is( $enc_decoded, "×—×™×™×", "decoded to correct value" ); |
52
|
|
|
|
|
|
|
|
53
|
17
|
|
|
|
|
5789
|
ok( !Encode::is_utf8($bin->binary), "preserved arbitrary bytes" ); |
54
|
17
|
|
|
|
|
5748
|
is( length($bin->binary), length($bytes), "bytes not truncated" ); |
55
|
17
|
|
|
|
|
5807
|
is( unpack("H*", $bin->binary), unpack("H*", $bytes), "bytes equal" ); |
56
|
17
|
|
|
|
|
292
|
}); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__PACKAGE__ |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |