File: 03-args.t

package info (click to toggle)
libclass-loader-perl 2.03-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 88 kB
  • sloc: perl: 185; makefile: 2
file content (47 lines) | stat: -rwxr-xr-x 1,016 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
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl -st
##
## Class::Loader Test Suite
##
## Copyright (c) 2001, Vipul Ved Prakash.  All rights reserved.
## This code is free software; you can redistribute it and/or modify
## it under the same terms as Perl itself.
##
## $Id: 03-args.t,v 1.1 2001/05/02 02:57:03 vipul Exp $

use lib '../lib', 'lib';
package Class::Loader::Test01;
use Class::Loader;
use vars qw(@ISA);
@ISA = (Class::Loader);

sub new { 

    return bless {}, shift;

}

sub test { 

    my $self = shift;
    my $n = "value";
    my $ref = { 4 => 2 };
    $self->{Handler} = $self->_load ( 
            Module => "Class::LoaderTest", 
            Constructor => "blah", 
            Args => [ "abc" => "xyz", $n => [qw(sd ds dd)], 'c' => $ref ],
    ) || die $!;

}

package main;

use Test;
BEGIN { plan tests => 4 };

my $test = new Class::Loader::Test01;
$test->test();
ok("sd", @{$test->{Handler}->{value}}[0]);
ok("dd", @{$test->{Handler}->{value}}[2]);
ok("xyz", $test->{Handler}->{abc});
ok("2", $test->{Handler}->{c}->{4});