File: 00general.t

package info (click to toggle)
libclone-fast-perl 0.96-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 344 kB
  • sloc: perl: 200; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download
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
35
36
37
38
39
40
41
42
43
44
use strict;
use warnings;
use Test::More;

my @structures;

BEGIN {
    @structures = (
        1,
        '1',
        1.0,
        '1.0',
        [qw( one )],
        [qw( one two three four five )],
        { 'key' => 'value' },
        { 'key' => { 'key' => 'value' } },

        # More complex
        [   {   'key' => {
                    'arr' => [qw( some thing here )],
                    'AoH' =>
                        [ { 'a' => { 'b' => { 'c' => { 'd' => 'e' } } } } ],
                }
            },
            [   [   'key' => {
                        'arr' => [qw( some thing here )],
                        'AoH' => [
                            { 'a' => { 'b' => { 'c' => { 'd' => 'e' } } } }
                        ],
                    }
                ],
            ],
        ],
    );
    plan( tests => 1 + @structures );
}

use Clone::Fast qw( clone );
use_ok('Clone::Fast');

for (@structures) {
    is_deeply( $_, clone($_),
        join( ' ', 'A', ref($_), qw( structure was cloned appropriately ) ) );
}