1use strict; 2use warnings; 3 4use CPAN::Meta::Requirements; 5 6use Test::More 0.88; 7 8{ 9 my $req = CPAN::Meta::Requirements->new->add_minimum(Foo => 1); 10 11 ok( $req->accepts_module(Foo => 1), "need 1, got 1"); 12 ok(! $req->accepts_module(Foo => 0), "need 0, got 1"); 13} 14 15{ 16 my $req = CPAN::Meta::Requirements->new->add_minimum(Foo => 0); 17 18 ok( $req->accepts_module(Foo => 1), "need 0, got 1"); 19 ok( $req->accepts_module(Foo => undef), "need 0, got undef"); 20 ok( $req->accepts_module(Foo => "v0"), "need 0, got 'v0'"); 21 ok( $req->accepts_module(Foo => v1.2.3), "need 0, got v1.2.3"); 22 ok( $req->accepts_module(Foo => "v1.2.3"), "need 0, got 'v1.2.3'"); 23} 24 25{ 26 my $req = CPAN::Meta::Requirements->new->add_maximum(Foo => 1); 27 28 ok( $req->accepts_module(Foo => 1), "need <=1, got 1"); 29 ok(! $req->accepts_module(Foo => 2), "need <=1, got 2"); 30} 31 32{ 33 my $req = CPAN::Meta::Requirements->new->add_exclusion(Foo => 1); 34 35 ok( $req->accepts_module(Foo => 0), "need !1, got 0"); 36 ok(! $req->accepts_module(Foo => 1), "need !1, got 1"); 37} 38 39done_testing; 40