comparison Lib/IMPL/Test.pm @ 0:03e58a454b20

Создан репозитарий
author Sergey
date Tue, 14 Jul 2009 12:54:37 +0400
parents
children 2e546a5175dd
comparison
equal deleted inserted replaced
-1:000000000000 0:03e58a454b20
1 package IMPL::Test;
2 use strict;
3 use warnings;
4
5 require Exporter;
6 our @ISA = qw(Exporter);
7 our @EXPORT_OK = qw(&test &shared);
8
9 require IMPL::Test::Unit;
10 use IMPL::Class::Member;
11
12 sub test($$) {
13 my ($name,$code) = @_;
14 my $class = caller;
15
16 $class->set_meta(
17 new IMPL::Test::Unit::TestInfo( $name, $code )
18 );
19 }
20
21 sub shared($) {
22 my ($propInfo) = @_;
23
24 my $class = caller;
25
26 die new IMPL::Exception("Only properties could be declared as shared",$propInfo->Name) unless eval {$propInfo->isa('IMPL::Class::PropertyInfo')};
27 die new IMPL::Exception("You can't mark the readonly property as shared",$propInfo->Name) unless $propInfo->canSet;
28 die new IMPL::Exception("Only public properties could be declared as shared",$propInfo->Name) unless $propInfo->Access == IMPL::Class::Member::MOD_PUBLIC;
29
30 $class->set_meta(new IMPL::Test::Unit::SharedData($propInfo->Name));
31 }
32 1;