File: 04arraysRT21218.t

package info (click to toggle)
libphp-serialization-perl 0.34-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 152 kB
  • sloc: perl: 387; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 861 bytes parent folder | download | duplicates (3)
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
30
31
32
33
34
use strict;
use warnings;
use Data::Dumper;
use Test::More tests => 3;

BEGIN { use_ok('PHP::Serialization') };

my $data = PHP::Serialization::unserialize(
    q{a:1:{s:3:"lll";a:2:{i:195;a:1:{i:111;s:3:"bbb";}i:194;a:1:{i:222;s:3:"ccc";}}}}
);

    is_deeply($data,
        {
            'lll' => {
                '195' => {111 => 'bbb'},
                '194' => {222 => 'ccc'},
            }
        },
		'Only numbers as hashindexes works'		
    ) or warn Dumper($data);

$data = PHP::Serialization::unserialize(
    q{a:1:{s:3:"lll";a:2:{i:195;a:2:{i:0;i:111;i:1;s:3:"bbb";}i:194;a:2:{i:0;i:222;i:1;s:3:"ccc";}}}}
);

    is_deeply($data,
        {
            'lll' => {
                '195' => [111, 'bbb'],
                '194' => [222, 'ccc'],
            }
        },
		'Only numbers as hashindexes works with arrays'
    ) or warn Dumper($data);