| 1 |
#! perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
use Test::More; |
| 7 |
use Config; |
| 8 |
use CPAN::Requirements::Dynamic; |
| 9 |
|
| 10 |
my $dynamic = CPAN::Requirements::Dynamic->new; |
| 11 |
|
| 12 |
my $result1 = $dynamic->evaluate({ |
| 13 |
version => 1, |
| 14 |
expressions => [ |
| 15 |
{ |
| 16 |
condition => [ has_perl => "$]" ], |
| 17 |
prereqs => { Foo => "1.2" }, |
| 18 |
}, |
| 19 |
{ |
| 20 |
condition => [ not => has_perl => 5 ], |
| 21 |
prereqs => { Bar => "1.3" }, |
| 22 |
}, |
| 23 |
{ |
| 24 |
condition => [ is_os => $^O ], |
| 25 |
prereqs => { Baz => "1.4" }, |
| 26 |
}, |
| 27 |
{ |
| 28 |
condition => [ or => [ config_defined => 'useperlio' ] ], |
| 29 |
prereqs => { Quz => "1.5" }, |
| 30 |
}, |
| 31 |
{ |
| 32 |
condition => [ and => [ has_perl => "$]" ], [ is_os => 'non-existent' ] ], |
| 33 |
prereqs => { Euz => "1.7" }, |
| 34 |
}, |
| 35 |
], |
| 36 |
}); |
| 37 |
|
| 38 |
my $hash1 = $result1->as_string_hash; |
| 39 |
is_deeply($hash1, { runtime => { requires => { Foo => '1.2', Baz => '1.4', Quz => '1.5' } } }) or diag explain $hash1; |
| 40 |
|
| 41 |
done_testing; |