4 use CPAN::Meta::Requirements;
9 my ($code, $qr, $comment) = @_;
11 my $lived = eval { $code->(); 1 };
14 fail("$comment: did not die");
16 like($@, $qr, $comment);
23 Shared => '>= 2, <= 9, != 7',
27 my $req = CPAN::Meta::Requirements->from_string_hash($string_hash);
32 "we can load from a string hash",
43 dies_ok { CPAN::Meta::Requirements->from_string_hash($string_hash) }
45 "we die when we can't understand a version spec";
56 local $SIG{__WARN__} = sub { $warning = join("\n",@_) };
58 my $req = CPAN::Meta::Requirements->from_string_hash($string_hash);
61 $req->as_string_hash->{Shared}, 0,
62 "undef requirement treated as '0'",
65 like ($warning, qr/Undefined requirement.*treated as '0'/, "undef requirement warns");