tests for around does => sub {...}
Toby Inkster [Fri, 19 Oct 2012 13:52:10 +0000 (14:52 +0100)]
t/around-does.t [new file with mode: 0644]

diff --git a/t/around-does.t b/t/around-does.t
new file mode 100644 (file)
index 0000000..3b36d5d
--- /dev/null
@@ -0,0 +1,31 @@
+use Test::More;
+
+my $pass;
+my $pass2;
+
+BEGIN {
+       package Local::Role;
+       use Role::Tiny;
+       around does => sub {
+               my ($orig, $self, @args) = @_;
+               $pass++;
+               return $self->$orig(@args);
+       };
+       around DOES => sub {
+               my ($orig, $self, @args) = @_;
+               $pass2++;
+               return $self->$orig(@args);
+       };
+}
+
+BEGIN {
+       package Local::Class;
+       use Role::Tiny::With;
+       with 'Local::Role';
+}
+
+ok(Local::Class->does('Local::Role'));
+ok($pass);
+ok(Local::Class->DOES('Local::Role'));
+ok($pass2);
+done_testing();
\ No newline at end of file