[Moose-commits] r7288 - Moose/trunk/t/100_bugs
autarch at code2.0beta.co.uk
autarch at code2.0beta.co.uk
Mon Jan 12 00:44:38 GMT 2009
Author: autarch
Date: 2009-01-11 16:44:37 -0800 (Sun, 11 Jan 2009)
New Revision: 7288
Modified:
Moose/trunk/t/100_bugs/020_super_recursion.t
Log:
Turn on strict & warnings. Tidy code. Shut up a warning.
Modified: Moose/trunk/t/100_bugs/020_super_recursion.t
===================================================================
--- Moose/trunk/t/100_bugs/020_super_recursion.t 2009-01-11 23:45:01 UTC (rev 7287)
+++ Moose/trunk/t/100_bugs/020_super_recursion.t 2009-01-12 00:44:37 UTC (rev 7288)
@@ -1,34 +1,70 @@
-#!/usr/bin/env perl -l
-use Test::More qw(no_plan);
-our $seen;
+use strict;
+use warnings;
-package A;
-use Moose;
+use Test::More 'no_plan';
-sub foo { ::BAIL_OUT('A::foo called twice') if $main::seen{'A::foo'}++; return 'a' }
-sub bar { ::BAIL_OUT('A::bar called twice') if $main::seen{'A::bar'}++; return 'a' }
-sub baz { ::BAIL_OUT('A::baz called twice') if $main::seen{'A::baz'}++; return 'a' }
+{
-package B;
-use Moose;
-extends qw(A);
+ package A;
+ use Moose;
+ sub foo {
+ ::BAIL_OUT('A::foo called twice') if $main::seen{'A::foo'}++;
+ return 'a';
+ }
-sub foo { ::BAIL_OUT('B::foo called twice') if $main::seen{'B::foo'}++; return 'b'.super() }
-sub bar { ::BAIL_OUT('B::bar called twice') if $main::seen{'B::bar'}++; return 'b'.super() }
-override baz => sub { ::BAIL_OUT('B::baz called twice') if $main::seen{'B::baz'}++; return 'b'.super() };
+ sub bar {
+ ::BAIL_OUT('A::bar called twice') if $main::seen{'A::bar'}++;
+ return 'a';
+ }
-package C;
-use Moose;
-extends qw(B);
+ sub baz {
+ ::BAIL_OUT('A::baz called twice') if $main::seen{'A::baz'}++;
+ return 'a';
+ }
+}
-sub foo { return 'c'.super() }
-override bar => sub { ::BAIL_OUT('C::bar called twice') if $main::seen{'C::bar'}++; return 'c'.super() };
-override baz => sub { ::BAIL_OUT('C::baz called twice') if $main::seen{'C::baz'}++; return 'c'.super() };
+{
+ package B;
+ use Moose;
+ extends qw(A);
-package main;
+ sub foo {
+ ::BAIL_OUT('B::foo called twice') if $main::seen{'B::foo'}++;
+ return 'b' . super();
+ }
-is(C->new->foo, 'c');
-is(C->new->bar, 'cb');
-is(C->new->baz, 'cba');
+ sub bar {
+ ::BAIL_OUT('B::bar called twice') if $main::seen{'B::bar'}++;
+ return 'b' . super();
+ }
+
+ override baz => sub {
+ ::BAIL_OUT('B::baz called twice') if $main::seen{'B::baz'}++;
+ return 'b' . super();
+ };
+}
+
+{
+
+ package C;
+ use Moose;
+ extends qw(B);
+
+ sub foo { return 'c' . ( super() || '' ) }
+
+ override bar => sub {
+ ::BAIL_OUT('C::bar called twice') if $main::seen{'C::bar'}++;
+ return 'c' . super();
+ };
+
+ override baz => sub {
+ ::BAIL_OUT('C::baz called twice') if $main::seen{'C::baz'}++;
+ return 'c' . super();
+ };
+}
+
+is( C->new->foo, 'c' );
+is( C->new->bar, 'cb' );
+is( C->new->baz, 'cba' );
More information about the Moose-commits
mailing list