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

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