summaryrefslogtreecommitdiffstats
path: root/t/06-runtime.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-01-13 13:41:47 -0600
committerJesse Luehrs <doy@tozt.net>2011-01-13 13:41:47 -0600
commit197e3362e92f58cba6ce3d60e1b12ca0ed3c69ce (patch)
tree39232b57a38ecbd9f1bf4c0336eae5bb3036f7d8 /t/06-runtime.t
parentb7e4e8e25e10d97446650b2c2298088e093e6890 (diff)
downloaddist-checkconflicts-197e3362e92f58cba6ce3d60e1b12ca0ed3c69ce.tar.gz
dist-checkconflicts-197e3362e92f58cba6ce3d60e1b12ca0ed3c69ce.zip
more in depth tests for runtime warnings
Diffstat (limited to 't/06-runtime.t')
-rw-r--r--t/06-runtime.t42
1 files changed, 42 insertions, 0 deletions
diff --git a/t/06-runtime.t b/t/06-runtime.t
new file mode 100644
index 0000000..6e429b7
--- /dev/null
+++ b/t/06-runtime.t
@@ -0,0 +1,42 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use lib 't/lib/06';
+
+sub warnings_ok {
+ my ($class, $expected) = @_;
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+ my $warnings;
+ local $SIG{__WARN__} = sub { $warnings .= $_[0] };
+ use_ok($class);
+ is($warnings, $expected, "correct runtime warnings for $class");
+}
+
+warnings_ok('Foo', <<'WARNINGS');
+Conflict detected for Foo::Conflicts:
+ Foo::Foo is version 0.01, but must be greater than version 0.01
+Conflict detected for Foo::Conflicts:
+ Foo::Bar is version 0.01, but must be greater than version 0.01
+WARNINGS
+warnings_ok('Bar', <<'WARNINGS');
+Conflict detected for Bar::Conflicts:
+ Bar::Baz::Bad is version 0.01, but must be greater than version 0.01
+Conflict detected for Bar::Conflicts:
+ Bar::Foo::Bad is version 0.01, but must be greater than version 0.01
+Conflict detected for Bar::Conflicts:
+ Bar::Foo is version 0.01, but must be greater than version 0.01
+Conflict detected for Bar::Conflicts:
+ Bar::Bar::Bad is version 0.01, but must be greater than version 0.01
+Conflict detected for Bar::Conflicts:
+ Bar::Bar is version 0.01, but must be greater than version 0.01
+Conflict detected for Bar::Conflicts:
+ Bar::Quux::Bad is version 0.01, but must be greater than version 0.01
+WARNINGS
+
+is(scalar(grep { ref($_) eq 'ARRAY' && @$_ > 1 && ref($_->[1]) eq 'HASH' }
+ @INC),
+ 1,
+ "only installed one \@INC hook");
+
+done_testing;