X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fsugar.t;h=fd547ee978765ddb641b4716a9a19924c55f89ec;hb=b52072dc659832e3465ecb4801024bc7c05ddad7;hp=8b5191714c6b4d98368823d0d02f57054932d030;hpb=003ac39454443d373661470385ab69d05160b112;p=p5sagit%2FDevel-Declare.git diff --git a/t/sugar.t b/t/sugar.t index 8b51917..fd547ee 100644 --- a/t/sugar.t +++ b/t/sugar.t @@ -6,15 +6,15 @@ BEGIN { 'DeclareTest', 'method', DECLARE_PACKAGE | DECLARE_PROTO, sub { my ($name, $proto) = @_; -no warnings 'uninitialized'; -warn "NP: ".join(', ', @_)."\n"; +#no warnings 'uninitialized'; +#warn "NP: ".join(', ', @_)."\n"; return 'my $self = shift;' unless defined $proto && $proto ne '@_'; return 'my ($self'.(length $proto ? ", ${proto}" : "").') = @_;'; }, sub { my ($name, $proto, $sub, @rest) = @_; -no warnings 'uninitialized'; -warn "NPS: ".join(', ', @_)."\n"; +#no warnings 'uninitialized'; +#warn "NPS: ".join(', ', @_)."\n"; if (defined $name && length $name) { unless ($name =~ /::/) { $name = "DeclareTest::${name}"; @@ -42,7 +42,7 @@ my ($test_method1, $test_method2, @test_list); return (ref $self).': Foo: '.$foo; }; - method upgrade () { + method upgrade(){ # no spaces to make case pathological bless($self, 'DeclareTest2'); }; @@ -58,11 +58,13 @@ my ($test_method1, $test_method2, @test_list); return join(', ', ref $self, $what); }; - @test_list = method { 1 }, sub { 2 }, method () { 3 }, sub { 4 }; + method main () { return "main"; }; + + #@test_list = method { 1 }, sub { 2 }, method () { 3 }, sub { 4 }; } -use Test::More 'no_plan'; +use Test::More; my $o = DeclareTest->new(attr => "value"); @@ -72,6 +74,8 @@ is($o->{attr}, 'value', '@_ args ok'); is($o->foo('yay'), 'DeclareTest: Foo: yay', 'method with argument ok'); +is($o->main, 'main', 'declaration of package named method ok'); + $o->upgrade; isa_ok($o, 'DeclareTest2'); @@ -82,4 +86,6 @@ is($o->$test_method1('no', 'yes'), 'value, yes', 'anon method with @_ ok'); is($o->$test_method2('this'), 'DeclareTest2, this', 'anon method with proto ok'); -warn map { $_->() } @test_list; +#warn map { $_->() } @test_list; + +done_testing;