diff options
Diffstat (limited to 't/impl-selection/03-var.t')
-rw-r--r-- | t/impl-selection/03-var.t | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/t/impl-selection/03-var.t b/t/impl-selection/03-var.t new file mode 100644 index 0000000..dd5e7d8 --- /dev/null +++ b/t/impl-selection/03-var.t @@ -0,0 +1,29 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; + +# XXX: work around dumb core segfault bug when you delete stashes +sub get_impl { eval '$Package::Stash::IMPLEMENTATION' } +sub set_impl { eval '$Package::Stash::IMPLEMENTATION = "' . $_[0] . '"' } + +{ + $Package::Stash::IMPLEMENTATION = 'PP'; + require Package::Stash; + is(get_impl, 'PP', "autodetected properly: PP"); + can_ok('Package::Stash', 'new'); +} + +delete $Package::{'Stash::'}; +delete $INC{'Package/Stash.pm'}; +delete $INC{'Package/Stash/PP.pm'}; + +SKIP: { + skip "no XS", 2 unless eval "require Package::Stash::XS; 1"; + $Package::Stash::IMPLEMENTATION = 'XS'; + require Package::Stash; + is(get_impl, 'XS', "autodetected properly: XS"); + can_ok('Package::Stash', 'new'); +} + +done_testing; |