summaryrefslogtreecommitdiffstats
path: root/t/02-conflicts.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-11-21 17:10:52 -0600
committerJesse Luehrs <doy@tozt.net>2010-11-21 17:10:52 -0600
commit8cc54374790f8728eb1be75bbbab33b91ae69838 (patch)
tree5f917bbb63de611b4db10e2de6c27408cf17a214 /t/02-conflicts.t
parent6103054b33641423790d0e39c3e369bf79fe2c9c (diff)
downloaddist-checkconflicts-8cc54374790f8728eb1be75bbbab33b91ae69838.tar.gz
dist-checkconflicts-8cc54374790f8728eb1be75bbbab33b91ae69838.zip
initial implementation
Diffstat (limited to 't/02-conflicts.t')
-rw-r--r--t/02-conflicts.t70
1 files changed, 70 insertions, 0 deletions
diff --git a/t/02-conflicts.t b/t/02-conflicts.t
new file mode 100644
index 0000000..7303be2
--- /dev/null
+++ b/t/02-conflicts.t
@@ -0,0 +1,70 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+use lib 't/lib/02';
+
+{
+ use_ok('Foo::Conflicts::Good');
+ is_deeply(
+ [ Foo::Conflicts::Good->calculate_conflicts ],
+ [],
+ "correct versions for all conflicts",
+ );
+ is(
+ exception { Foo::Conflicts::Good->check_conflicts },
+ undef,
+ "no conflict error"
+ );
+}
+
+{
+ use_ok('Foo::Conflicts::Bad');
+ is_deeply(
+ [ Foo::Conflicts::Bad->calculate_conflicts ],
+ [
+ { package => 'Foo', installed => '0.02', required => '0.03' },
+ { package => 'Foo::Two', installed => '0.02', required => '0.02' },
+ ],
+ "correct versions for all conflicts",
+ );
+ is(
+ exception { Foo::Conflicts::Bad->check_conflicts },
+ "Conflicts detected for Foo::Conflicts::Bad:\n Foo is version 0.02, but must be greater than version 0.03\n Foo::Two is version 0.02, but must be greater than version 0.02\n",
+ "correct conflict error"
+ );
+}
+
+{
+ use_ok('Bar::Conflicts::Good');
+ is_deeply(
+ [ Bar::Conflicts::Good->calculate_conflicts ],
+ [],
+ "correct versions for all conflicts",
+ );
+ is(
+ exception { Bar::Conflicts::Good->check_conflicts },
+ undef,
+ "no conflict error"
+ );
+}
+
+{
+ use_ok('Bar::Conflicts::Bad');
+ is_deeply(
+ [ Bar::Conflicts::Bad->calculate_conflicts ],
+ [
+ { package => 'Bar', installed => '0.02', required => '0.03' },
+ { package => 'Bar::Two', installed => '0.02', required => '0.02' },
+ ],
+ "correct versions for all conflicts",
+ );
+ is(
+ exception { Bar::Conflicts::Bad->check_conflicts },
+ "Conflicts detected for Bar::Conflicts::Bad:\n Bar is version 0.02, but must be greater than version 0.03\n Bar::Two is version 0.02, but must be greater than version 0.02\n",
+ "correct conflict error"
+ );
+}
+
+done_testing;