summaryrefslogtreecommitdiff
path: root/cpan/CPAN-Meta-Requirements/t/accepts.t
blob: 75bc22f7ad8f5f6caa9653f0fb337b86a0bf5806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use strict;
use warnings;

use CPAN::Meta::Requirements;

use Test::More 0.88;

{
  my $req = CPAN::Meta::Requirements->new->add_minimum(Foo => 1);

  ok(  $req->accepts_module(Foo => 1));
  ok(! $req->accepts_module(Foo => 0));
}

{
  my $req = CPAN::Meta::Requirements->new->add_minimum(Foo => 0);

  ok(  $req->accepts_module(Foo => 1));
  ok(  $req->accepts_module(Foo => undef));
  ok(  $req->accepts_module(Foo => "v0"));
  ok(  $req->accepts_module(Foo => v1.2.3));
  ok(  $req->accepts_module(Foo => "v1.2.3"));
}

{
  my $req = CPAN::Meta::Requirements->new->add_maximum(Foo => 1);

  ok(  $req->accepts_module(Foo => 1));
  ok(! $req->accepts_module(Foo => 2));
}

{
  my $req = CPAN::Meta::Requirements->new->add_exclusion(Foo => 1);

  ok(  $req->accepts_module(Foo => 0));
  ok(! $req->accepts_module(Foo => 1));
}

done_testing;