File: _new.t

package info (click to toggle)
libtest-class-perl 0.35-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 476 kB
  • ctags: 102
  • sloc: perl: 1,668; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 555 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/perl -T

use strict;
use warnings;
use Test::Builder;
use Test::More tests => 6;

BEGIN {
	use_ok('Test::Class')  || Test::Builder->BAILOUT("CANNOT USE Test::Class");
};

package Foo;
use base qw(Test::Class);

package main;

my $tc = Foo->new(foo => 42, bar=>3);
isa_ok($tc, "Test::Class") || Test::Builder->BAILOUT("CANNOT CREATE Test::Class OBJECTS");
is($tc->{foo}, 42, 'key/value set');

my $tc2 = $tc->new(bar => 12);
isa_ok($tc2, "Test::Class");
is($tc2->{foo}, 42, 'prototype key/value set');
is($tc2->{bar}, 12, 'new key/value set');