summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorKaren Etheridge <ether@cpan.org>2012-03-02 21:57:54 +0000
committerKaren Etheridge <ether@cpan.org>2013-06-21 21:25:08 -0700
commitda64122a3fb0c5c747fb88dfce9909285697cfc2 (patch)
treeaa7230be847eb789eef134c2889ed4fd93bcef00 /t
parent8383bd1012327feb3823ac62222155d4f73cc6ce (diff)
downloaddist-checkconflicts-da64122a3fb0c5c747fb88dfce9909285697cfc2.tar.gz
dist-checkconflicts-da64122a3fb0c5c747fb88dfce9909285697cfc2.zip
fix for RT#75486: instead of silently ignoring conflicts that do not compile, issue a conflict warning
Diffstat (limited to 't')
-rw-r--r--t/02-conflicts.t26
-rw-r--r--t/lib/02/Broken.pm3
-rw-r--r--t/lib/02/Foo/Conflicts/Broken.pm11
-rw-r--r--t/lib/02/Foo/Conflicts/Good.pm1
4 files changed, 41 insertions, 0 deletions
diff --git a/t/02-conflicts.t b/t/02-conflicts.t
index 3d288a2..f59777f 100644
--- a/t/02-conflicts.t
+++ b/t/02-conflicts.t
@@ -3,6 +3,7 @@ use strict;
use warnings;
use Test::More;
use Test::Fatal;
+use Test::Warn;
use lib 't/lib/02';
{
@@ -69,4 +70,29 @@ use lib 't/lib/02';
);
}
+{
+ # conflicting module is utterly broken
+
+ use_ok('Foo::Conflicts::Broken');
+
+ my @conflicts;
+ warning_like { @conflicts = Foo::Conflicts::Broken->calculate_conflicts }
+ qr/Warning: Broken did not compile/,
+ 'Warning is issued when Broken fails to compile';
+
+ is_deeply(
+ \@conflicts,
+ [
+ { package => 'Broken', installed => 'unknown', required => '0.03' },
+ ],
+ "correct versions for all conflicts",
+ );
+
+ is(
+ exception { Foo::Conflicts::Broken->check_conflicts },
+ "Conflicts detected for Foo::Conflicts::Broken:\n Broken is version unknown, but must be greater than version 0.03\n",
+ "correct conflict error"
+ );
+}
+
done_testing;
diff --git a/t/lib/02/Broken.pm b/t/lib/02/Broken.pm
new file mode 100644
index 0000000..de400c3
--- /dev/null
+++ b/t/lib/02/Broken.pm
@@ -0,0 +1,3 @@
+package Broken;
+
+die 'this module is utterly broken';
diff --git a/t/lib/02/Foo/Conflicts/Broken.pm b/t/lib/02/Foo/Conflicts/Broken.pm
new file mode 100644
index 0000000..87043ae
--- /dev/null
+++ b/t/lib/02/Foo/Conflicts/Broken.pm
@@ -0,0 +1,11 @@
+package Foo::Conflicts::Broken;
+use strict;
+use warnings;
+
+use Dist::CheckConflicts
+ -conflicts => {
+ 'Broken' => '0.03',
+ 'NotInstalled' => '0.01',
+ };
+
+1;
diff --git a/t/lib/02/Foo/Conflicts/Good.pm b/t/lib/02/Foo/Conflicts/Good.pm
index f40a955..33d15de 100644
--- a/t/lib/02/Foo/Conflicts/Good.pm
+++ b/t/lib/02/Foo/Conflicts/Good.pm
@@ -7,6 +7,7 @@ use Dist::CheckConflicts
'Foo' => 0.01,
'Foo::Two' => 0.01,
'Foo::Three' => 0.01,
+ 'NotInstalled' => '0.01',
};
1;