summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-01-13 01:17:24 -0600
committerJesse Luehrs <doy@tozt.net>2011-01-13 01:17:24 -0600
commitc1d96ea5ce0260890f0e496438ab762728877154 (patch)
treef4058671c96c810c9aa86b801ee58d72cafc9642
parent288de96a697f56d6a1e4166004e1462837c5aacb (diff)
downloaddist-checkconflicts-c1d96ea5ce0260890f0e496438ab762728877154.tar.gz
dist-checkconflicts-c1d96ea5ce0260890f0e496438ab762728877154.zip
update tests to check for runtime warnings
-rw-r--r--t/02-conflicts.t28
-rw-r--r--t/03-dist.t28
2 files changed, 52 insertions, 4 deletions
diff --git a/t/02-conflicts.t b/t/02-conflicts.t
index 7303be2..e788815 100644
--- a/t/02-conflicts.t
+++ b/t/02-conflicts.t
@@ -20,7 +20,18 @@ use lib 't/lib/02';
}
{
- use_ok('Foo::Conflicts::Bad');
+ {
+ my $warnings;
+ local $SIG{__WARN__} = sub { $warnings .= $_[0] };
+ use_ok('Foo::Conflicts::Bad');
+ is($warnings, <<'EOF', "got correct runtime warnings");
+Conflict detected for Foo::Conflicts::Bad:
+ Foo::Two is version 0.02, but must be greater than version 0.02
+Conflict detected for Foo::Conflicts::Bad:
+ Foo is version 0.02, but must be greater than version 0.03
+EOF
+ }
+
is_deeply(
[ Foo::Conflicts::Bad->calculate_conflicts ],
[
@@ -51,7 +62,20 @@ use lib 't/lib/02';
}
{
- use_ok('Bar::Conflicts::Bad');
+ {
+ my $warnings;
+ local $SIG{__WARN__} = sub { $warnings .= $_[0] };
+ use_ok('Bar::Conflicts::Bad');
+ is($warnings, <<'EOF', "got correct runtime warnings");
+Conflict detected for Bar::Conflicts::Bad2:
+ Bar::Two is version 0.02, but must be greater than version 0.02
+Conflict detected for Bar::Conflicts::Bad:
+ Bar::Two is version 0.02, but must be greater than version 0.02
+Conflict detected for Bar::Conflicts::Bad:
+ Bar is version 0.02, but must be greater than version 0.03
+EOF
+ }
+
is_deeply(
[ Bar::Conflicts::Bad->calculate_conflicts ],
[
diff --git a/t/03-dist.t b/t/03-dist.t
index 65b08db..463c12f 100644
--- a/t/03-dist.t
+++ b/t/03-dist.t
@@ -21,7 +21,18 @@ use lib 't/lib/03';
}
{
- use_ok('Foo::Conflicts::Bad');
+ {
+ my $warnings;
+ local $SIG{__WARN__} = sub { $warnings .= $_[0] };
+ use_ok('Foo::Conflicts::Bad');
+ is($warnings, <<'EOF', "got correct runtime warnings");
+Conflict detected for Foo:
+ Foo::Two is version 0.02, but must be greater than version 0.02
+Conflict detected for Foo:
+ Foo is version 0.02, but must be greater than version 0.03
+EOF
+ }
+
is_deeply(
[ Foo::Conflicts::Bad->calculate_conflicts ],
[
@@ -54,7 +65,20 @@ use lib 't/lib/03';
}
{
- use_ok('Bar::Conflicts::Bad');
+ {
+ my $warnings;
+ local $SIG{__WARN__} = sub { $warnings .= $_[0] };
+ use_ok('Bar::Conflicts::Bad');
+ is($warnings, <<'EOF', "got correct runtime warnings");
+Conflict detected for Bar:
+ Bar::Two is version 0.02, but must be greater than version 0.02
+Conflict detected for Bar:
+ Bar::Two is version 0.02, but must be greater than version 0.02
+Conflict detected for Bar:
+ Bar is version 0.02, but must be greater than version 0.03
+EOF
+ }
+
is_deeply(
[ Bar::Conflicts::Bad->calculate_conflicts ],
[