root/URI-urn-uuid/trunk/t/01_uuid.t

Revision 1982 (checked in by miyagawa, 14 years ago)

0.02 of URI::urn::uuid. Added docs/tests

Line 
1 use strict;
2 use URI;
3 use URI::urn::uuid;
4 use Test::More 'no_plan';
5
6 my $uri = URI->new("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6");
7 isa_ok $uri, 'URI::urn::uuid';
8 is $uri->uuid, "f81d4fae-7dec-11d0-a765-00a0c91e6bf6";
9
10 ok $uri->uuid("f81d4fae-7dec-11d0-a765-00a0c91e6baa");
11 is $uri->uuid, "f81d4fae-7dec-11d0-a765-00a0c91e6baa", "set ok";
12
13 ok $uri->uuid_binary;
14
15 $uri = URI->new("urn:uuid:xxx");
16 isa_ok $uri, 'URI::urn::uuid';
17 is $uri->uuid, undef, "invalid uuid format - undef";
18 is $uri->uuid_binary, undef, "invalid uuid format - undef";
19
20 $uri = URI->new("urn:uuid:");
21 $uri->uuid("f81d4fae-7dec-11d0-a765-00a0c91e6bf6");
22 is $uri->uuid, "f81d4fae-7dec-11d0-a765-00a0c91e6bf6";
23
Note: See TracBrowser for help on using the browser.