-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Topic/demolish warnings #167
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use strict; | ||
use warnings; | ||
|
||
use lib 't/lib'; | ||
use Test::More tests => 1; | ||
|
||
my @warnings; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're using Test::Warnings in other tests. Might as well use it here too. That means you need to make it optional with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not entirely clear on how to write this test using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few ways, but the easiest is probably just to load |
||
BEGIN { | ||
$SIG{__WARN__} = sub { push @warnings, @_ }; | ||
} | ||
|
||
use Demolition::OnceRemoved; | ||
|
||
is scalar @warnings, 0, "No warnings" | ||
or diag explain \@warnings; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package Demolition::Demolisher; | ||
use Moose; | ||
|
||
sub DEMOLISH { } | ||
|
||
1; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package Demolition::OnceRemoved; | ||
use strict; | ||
use warnings; | ||
use Demolition::Demolisher; | ||
|
||
my $d = Demolition::Demolisher->new; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we move this into a block in the |
||
$d->DEMOLISH; | ||
|
||
1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment explaining why this is necessary would be good.