Add some code so we can figure out which implementation of PV was loaded
Add release tests that both are loadable.
Dave Rolsky
12 years ago
7 | 7 |
BEGIN {
|
8 | 8 |
use Exporter;
|
9 | 9 |
|
10 | |
use vars qw( $NO_VALIDATION %OPTIONS $options );
|
|
10 |
use vars qw( $NO_VALIDATION %OPTIONS $options $IMPLEMENTATION );
|
11 | 11 |
|
12 | 12 |
our @ISA = 'Exporter';
|
13 | 13 |
|
|
40 | 40 |
if ( $e || $ENV{PV_TEST_PERL} ) {
|
41 | 41 |
require Params::ValidatePP;
|
42 | 42 |
}
|
|
43 |
}
|
|
44 |
|
|
45 |
sub _implementation {
|
|
46 |
return $IMPLEMENTATION;
|
43 | 47 |
}
|
44 | 48 |
|
45 | 49 |
1;
|
23 | 23 |
sub HANDLE () { 16 | 32 }
|
24 | 24 |
sub BOOLEAN () { 1 | 256 }
|
25 | 25 |
}
|
|
26 |
|
|
27 |
$IMPLEMENTATION = 'PP';
|
26 | 28 |
|
27 | 29 |
# Various internals notes (for me and any future readers of this
|
28 | 30 |
# monstrosity):
|
6 | 6 |
require Carp;
|
7 | 7 |
Carp::confess( $_[0] );
|
8 | 8 |
};
|
|
9 |
|
|
10 |
$IMPLEMENTATION = 'XS';
|
9 | 11 |
|
10 | 12 |
{
|
11 | 13 |
my %defaults = (
|
|
0 |
use strict;
|
|
1 |
use warnings;
|
|
2 |
|
|
3 |
use Test::More;
|
|
4 |
|
|
5 |
BEGIN { $ENV{PV_TEST_PERL} = 1 }
|
|
6 |
|
|
7 |
use Params::Validate;
|
|
8 |
|
|
9 |
is(
|
|
10 |
Params::Validate::_implementation(), 'PP',
|
|
11 |
'PP implementation is loaded when env var is set'
|
|
12 |
);
|
|
13 |
|
|
14 |
done_testing();
|
|
0 |
use strict;
|
|
1 |
use warnings;
|
|
2 |
|
|
3 |
use Test::More;
|
|
4 |
|
|
5 |
use Params::Validate;
|
|
6 |
|
|
7 |
is(
|
|
8 |
Params::Validate::_implementation(), 'XS',
|
|
9 |
'XS implementation is loaded by default'
|
|
10 |
);
|
|
11 |
|
|
12 |
done_testing();
|