File: 02-subclass.t

package info (click to toggle)
liburi-smarturi-perl 0.031-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 188 kB
  • sloc: perl: 2,144; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 779 bytes parent folder | download | duplicates (4)
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
use strict;
use warnings;

use Test::More tests => 5;

{
    package MyURI;

    use base 'URI::SmartURI';

    sub mtfnpy {
        my $uri = shift;
        $uri->query_form([ $uri->query_form, qw(foo bar) ]);
        $uri
    }
}

BEGIN {
    MyURI->import('-import_uri_mods');
    use_ok('MyURI::URL')
}

is(MyURI::URL->new('http://search.cpan.org/~lwall/')->path,
    '/~lwall/', 'Magic import');

ok(my $uri = MyURI->new('http://www.catalystframework.org/calendar',
                    { reference => 'http://www.catalystframework.org/' }),
                    'new');

is($uri->mtfnpy,
   'http://www.catalystframework.org/calendar?foo=bar', 'new method');

is($uri->reference, 'http://www.catalystframework.org/', 'old method');

# vim: expandtab shiftwidth=4 ts=4 tw=80: