summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl0/lib/Test/NoWarnings/Warning.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl0/lib/Test/NoWarnings/Warning.pm')
-rwxr-xr-xMaster/tlpkg/tlperl0/lib/Test/NoWarnings/Warning.pm79
1 files changed, 79 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl0/lib/Test/NoWarnings/Warning.pm b/Master/tlpkg/tlperl0/lib/Test/NoWarnings/Warning.pm
new file mode 100755
index 00000000000..54db0bba71e
--- /dev/null
+++ b/Master/tlpkg/tlperl0/lib/Test/NoWarnings/Warning.pm
@@ -0,0 +1,79 @@
+package Test::NoWarnings::Warning;
+
+use 5.006;
+use strict;
+use warnings;
+use Carp ();
+
+use vars qw{$VERSION};
+BEGIN {
+ $VERSION = '1.01';
+}
+
+my $STACKTRACE = eval "require Devel::StackTrace" || 0;
+
+sub new {
+ my $class = shift;
+ bless { @_ }, $class;
+}
+
+sub getTrace {
+ my $self = shift;
+ return $self->{Trace};
+}
+
+sub fillTrace {
+ my $self = shift;
+ $self->{Trace} = Devel::StackTrace->new(
+ ignore_class => [__PACKAGE__, @_],
+ ) if $STACKTRACE;
+}
+
+sub getCarp {
+ $_[0]->{Carp};
+}
+
+sub fillCarp {
+ my $self = shift;
+ my $msg = shift;
+ $Carp::Internal{ __PACKAGE__ . "" }++;
+ local $Carp::CarpLevel = $Carp::CarpLevel + 1;
+ $self->{Carp} = Carp::longmess($msg);
+ $Carp::Internal{ __PACKAGE__ . "" }--;
+}
+
+sub getMessage {
+ $_[0]->{Message};
+}
+
+sub setMessage {
+ $_[0]->{Message} = $_[1];
+}
+
+sub fillTest {
+ my $self = shift;
+ my $builder = shift;
+ my $prev_test = $builder->current_test;
+ $self->{Test} = $prev_test;
+ my @tests = $builder->details;
+ my $prev_test_name = $prev_test ? $tests[$prev_test - 1]->{name} : "";
+ $self->{TestName} = $prev_test_name;
+}
+
+sub getTest {
+ $_[0]->{Test};
+}
+
+sub getTestName {
+ $_[0]->{TestName};
+}
+
+sub toString {
+ my $self = shift;
+ return <<EOM;
+ Previous test $self->{Test} '$self->{TestName}'
+ $self->{Carp}
+EOM
+}
+
+1;