t0m's around vs. immutable bug
Yuval Kogman [Fri, 27 Jun 2008 09:42:21 +0000 (09:42 +0000)]
t/100_bugs/015_immutable_n_around.t [new file with mode: 0644]

diff --git a/t/100_bugs/015_immutable_n_around.t b/t/100_bugs/015_immutable_n_around.t
new file mode 100644 (file)
index 0000000..95d4202
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More 'no_plan';
+
+{
+    package Foo;
+    use Moose;
+
+    has foo => ( is => "ro" );
+
+    __PACKAGE__->meta->make_immutable;
+
+    package Bar;
+    use Moose;
+
+    extends qw(Foo);
+
+    around new => sub {
+        my $next = shift;
+        my ( $self, @args ) = @_;
+        $self->$next( foo => 42 );
+    };
+
+    __PACKAGE__->meta->make_immutable;
+
+    package Gorch;
+    use Moose;
+
+    extends qw(Bar);
+
+    __PACKAGE__->meta->make_immutable;
+}
+
+is( Gorch->new->foo, 42, "around new called" );