File: universal.t

package info (click to toggle)
libobject-id-perl 0.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 176 kB
  • ctags: 9
  • sloc: perl: 291; makefile: 2
file content (47 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (5)
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
45
46
47
#!/usr/bin/perl -w

use strict;
use warnings;

use Test::More;

{
    package My::Class;

    sub new {
        my $class = shift;
        bless {}, $class;
    }
}

use UNIVERSAL::Object::ID;

# Is it universal?
{
    my $obj = new_ok "My::Class";
    ok $obj->object_id;
}

# What about a totally unrelated module?
{
    use DirHandle;
    my $dh = DirHandle->new(".");
    ok $dh->object_id;

    my $dh2 = DirHandle->new(".");
    ok $dh2->object_id;

    isnt $dh->object_id, $dh2->object_id;
}

# A regex object?
{
    my $re = qr/foo/;
    ok $re->object_id;

    my $re2 = qr/foo/;
    isnt $re->object_id, $re2->object_id;
}


done_testing;