summaryrefslogtreecommitdiffstats
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
parentb7e4e8e25e10d97446650b2c2298088e093e6890 (diff)
downloaddist-checkconflicts-197e3362e92f58cba6ce3d60e1b12ca0ed3c69ce.tar.gz
dist-checkconflicts-197e3362e92f58cba6ce3d60e1b12ca0ed3c69ce.zip
more in depth tests for runtime warnings
-rw-r--r--t/06-runtime.t42
-rw-r--r--t/lib/06/Bar.pm13
-rw-r--r--t/lib/06/Bar/Bar.pm10
-rw-r--r--t/lib/06/Bar/Bar/Bad.pm7
-rw-r--r--t/lib/06/Bar/Bar/Good.pm7
-rw-r--r--t/lib/06/Bar/Baz.pm10
-rw-r--r--t/lib/06/Bar/Baz/Bad.pm7
-rw-r--r--t/lib/06/Bar/Baz/Good.pm7
-rw-r--r--t/lib/06/Bar/Conflicts.pm21
-rw-r--r--t/lib/06/Bar/Foo.pm10
-rw-r--r--t/lib/06/Bar/Foo/Bad.pm7
-rw-r--r--t/lib/06/Bar/Foo/Good.pm7
-rw-r--r--t/lib/06/Bar/Quux.pm10
-rw-r--r--t/lib/06/Bar/Quux/Bad.pm7
-rw-r--r--t/lib/06/Bar/Quux/Good.pm7
-rw-r--r--t/lib/06/Foo.pm13
-rw-r--r--t/lib/06/Foo/Bar.pm7
-rw-r--r--t/lib/06/Foo/Baz.pm7
-rw-r--r--t/lib/06/Foo/Conflicts.pm13
-rw-r--r--t/lib/06/Foo/Foo.pm7
-rw-r--r--t/lib/06/Foo/Quux.pm7
21 files changed, 226 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;
diff --git a/t/lib/06/Bar.pm b/t/lib/06/Bar.pm
new file mode 100644
index 0000000..8691a44
--- /dev/null
+++ b/t/lib/06/Bar.pm
@@ -0,0 +1,13 @@
+package Bar;
+use strict;
+use warnings;
+
+use Bar::Foo;
+use Bar::Baz;
+
+use Bar::Conflicts;
+
+use Bar::Bar;
+use Bar::Quux;
+
+1;
diff --git a/t/lib/06/Bar/Bar.pm b/t/lib/06/Bar/Bar.pm
new file mode 100644
index 0000000..b355817
--- /dev/null
+++ b/t/lib/06/Bar/Bar.pm
@@ -0,0 +1,10 @@
+package Bar::Bar;
+use strict;
+use warnings;
+
+use Bar::Bar::Good;
+use Bar::Bar::Bad;
+
+our $VERSION = 0.01;
+
+1;
diff --git a/t/lib/06/Bar/Bar/Bad.pm b/t/lib/06/Bar/Bar/Bad.pm
new file mode 100644
index 0000000..9a4792b
--- /dev/null
+++ b/t/lib/06/Bar/Bar/Bad.pm
@@ -0,0 +1,7 @@
+package Bar::Bar::Bad;
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+1;
diff --git a/t/lib/06/Bar/Bar/Good.pm b/t/lib/06/Bar/Bar/Good.pm
new file mode 100644
index 0000000..58e6d78
--- /dev/null
+++ b/t/lib/06/Bar/Bar/Good.pm
@@ -0,0 +1,7 @@
+package Bar::Bar::Good;
+use strict;
+use warnings;
+
+our $VERSION = 0.02;
+
+1;
diff --git a/t/lib/06/Bar/Baz.pm b/t/lib/06/Bar/Baz.pm
new file mode 100644
index 0000000..8704283
--- /dev/null
+++ b/t/lib/06/Bar/Baz.pm
@@ -0,0 +1,10 @@
+package Bar::Baz;
+use strict;
+use warnings;
+
+use Bar::Baz::Good;
+use Bar::Baz::Bad;
+
+our $VERSION = 0.02;
+
+1;
diff --git a/t/lib/06/Bar/Baz/Bad.pm b/t/lib/06/Bar/Baz/Bad.pm
new file mode 100644
index 0000000..c92da0e
--- /dev/null
+++ b/t/lib/06/Bar/Baz/Bad.pm
@@ -0,0 +1,7 @@
+package Bar::Baz::Bad;
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+1;
diff --git a/t/lib/06/Bar/Baz/Good.pm b/t/lib/06/Bar/Baz/Good.pm
new file mode 100644
index 0000000..2205717
--- /dev/null
+++ b/t/lib/06/Bar/Baz/Good.pm
@@ -0,0 +1,7 @@
+package Bar::Baz::Good;
+use strict;
+use warnings;
+
+our $VERSION = 0.02;
+
+1;
diff --git a/t/lib/06/Bar/Conflicts.pm b/t/lib/06/Bar/Conflicts.pm
new file mode 100644
index 0000000..ce47d43
--- /dev/null
+++ b/t/lib/06/Bar/Conflicts.pm
@@ -0,0 +1,21 @@
+package Bar::Conflicts;
+use strict;
+use warnings;
+
+use Dist::CheckConflicts
+ -conflicts => {
+ 'Bar::Foo' => 0.01,
+ 'Bar::Foo::Good' => 0.01,
+ 'Bar::Foo::Bad' => 0.01,
+ 'Bar::Bar' => 0.01,
+ 'Bar::Bar::Good' => 0.01,
+ 'Bar::Bar::Bad' => 0.01,
+ 'Bar::Baz' => 0.01,
+ 'Bar::Baz::Good' => 0.01,
+ 'Bar::Baz::Bad' => 0.01,
+ 'Bar::Quux' => 0.01,
+ 'Bar::Quux::Good' => 0.01,
+ 'Bar::Quux::Bad' => 0.01,
+ };
+
+1;
diff --git a/t/lib/06/Bar/Foo.pm b/t/lib/06/Bar/Foo.pm
new file mode 100644
index 0000000..005ae1f
--- /dev/null
+++ b/t/lib/06/Bar/Foo.pm
@@ -0,0 +1,10 @@
+package Bar::Foo;
+use strict;
+use warnings;
+
+use Bar::Foo::Good;
+use Bar::Foo::Bad;
+
+our $VERSION = 0.01;
+
+1;
diff --git a/t/lib/06/Bar/Foo/Bad.pm b/t/lib/06/Bar/Foo/Bad.pm
new file mode 100644
index 0000000..d4a58d3
--- /dev/null
+++ b/t/lib/06/Bar/Foo/Bad.pm
@@ -0,0 +1,7 @@
+package Bar::Foo::Bad;
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+1;
diff --git a/t/lib/06/Bar/Foo/Good.pm b/t/lib/06/Bar/Foo/Good.pm
new file mode 100644
index 0000000..f5d8b73
--- /dev/null
+++ b/t/lib/06/Bar/Foo/Good.pm
@@ -0,0 +1,7 @@
+package Bar::Foo::Good;
+use strict;
+use warnings;
+
+our $VERSION = 0.02;
+
+1;
diff --git a/t/lib/06/Bar/Quux.pm b/t/lib/06/Bar/Quux.pm
new file mode 100644
index 0000000..99d0312
--- /dev/null
+++ b/t/lib/06/Bar/Quux.pm
@@ -0,0 +1,10 @@
+package Bar::Quux;
+use strict;
+use warnings;
+
+use Bar::Quux::Good;
+use Bar::Quux::Bad;
+
+our $VERSION = 0.02;
+
+1;
diff --git a/t/lib/06/Bar/Quux/Bad.pm b/t/lib/06/Bar/Quux/Bad.pm
new file mode 100644
index 0000000..2238323
--- /dev/null
+++ b/t/lib/06/Bar/Quux/Bad.pm
@@ -0,0 +1,7 @@
+package Bar::Quux::Bad;
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+1;
diff --git a/t/lib/06/Bar/Quux/Good.pm b/t/lib/06/Bar/Quux/Good.pm
new file mode 100644
index 0000000..8692c2c
--- /dev/null
+++ b/t/lib/06/Bar/Quux/Good.pm
@@ -0,0 +1,7 @@
+package Bar::Quux::Good;
+use strict;
+use warnings;
+
+our $VERSION = 0.02;
+
+1;
diff --git a/t/lib/06/Foo.pm b/t/lib/06/Foo.pm
new file mode 100644
index 0000000..5fd77ef
--- /dev/null
+++ b/t/lib/06/Foo.pm
@@ -0,0 +1,13 @@
+package Foo;
+use strict;
+use warnings;
+
+use Foo::Foo;
+use Foo::Baz;
+
+use Foo::Conflicts;
+
+use Foo::Bar;
+use Foo::Quux;
+
+1;
diff --git a/t/lib/06/Foo/Bar.pm b/t/lib/06/Foo/Bar.pm
new file mode 100644
index 0000000..c4c6af8
--- /dev/null
+++ b/t/lib/06/Foo/Bar.pm
@@ -0,0 +1,7 @@
+package Foo::Bar;
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+1;
diff --git a/t/lib/06/Foo/Baz.pm b/t/lib/06/Foo/Baz.pm
new file mode 100644
index 0000000..665f3b5
--- /dev/null
+++ b/t/lib/06/Foo/Baz.pm
@@ -0,0 +1,7 @@
+package Foo::Baz;
+use strict;
+use warnings;
+
+our $VERSION = 0.02;
+
+1;
diff --git a/t/lib/06/Foo/Conflicts.pm b/t/lib/06/Foo/Conflicts.pm
new file mode 100644
index 0000000..15e50e7
--- /dev/null
+++ b/t/lib/06/Foo/Conflicts.pm
@@ -0,0 +1,13 @@
+package Foo::Conflicts;
+use strict;
+use warnings;
+
+use Dist::CheckConflicts
+ -conflicts => {
+ 'Foo::Foo' => 0.01,
+ 'Foo::Bar' => 0.01,
+ 'Foo::Baz' => 0.01,
+ 'Foo::Quux' => 0.01,
+ };
+
+1;
diff --git a/t/lib/06/Foo/Foo.pm b/t/lib/06/Foo/Foo.pm
new file mode 100644
index 0000000..ca6c28e
--- /dev/null
+++ b/t/lib/06/Foo/Foo.pm
@@ -0,0 +1,7 @@
+package Foo::Foo;
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+1;
diff --git a/t/lib/06/Foo/Quux.pm b/t/lib/06/Foo/Quux.pm
new file mode 100644
index 0000000..f813ae3
--- /dev/null
+++ b/t/lib/06/Foo/Quux.pm
@@ -0,0 +1,7 @@
+package Foo::Quux;
+use strict;
+use warnings;
+
+our $VERSION = 0.02;
+
+1;