Commit | Line | Data |
85ccab9a |
1 | use strict; |
2 | use warnings; |
3 | use FindBin qw($Bin); |
4 | use File::Spec::Functions; |
5 | use File::Spec::Unix (); # need this for %INC munging |
6 | use Test::More; |
7 | use lib 't/lib'; |
8 | |
9 | BEGIN { |
716410c9 |
10 | local $ENV{DEVEL_HIDE_VERBOSE} = 0; |
85ccab9a |
11 | eval { require Devel::Hide }; |
12 | if ($@) { |
13 | eval { require Sub::Name }; |
14 | plan skip_all => "Devel::Hide required for this test in presence of Sub::Name" |
15 | if ! $@; |
16 | } |
17 | else { |
18 | Devel::Hide->import('Sub/Name.pm'); |
19 | } |
20 | require Class::Accessor::Grouped; |
21 | } |
22 | |
ed606987 |
23 | |
85ccab9a |
24 | # rerun the regular 3 tests under the assumption of no Sub::Name |
ed606987 |
25 | our $SUBTESTING = 1; |
26 | for my $tname (qw/accessors.t accessors_ro.t accessors_wo.t/) { |
27 | |
28 | for (1,2) { |
29 | note "\nTesting $tname without Sub::Name (pass $_)\n\n"; |
85ccab9a |
30 | |
85ccab9a |
31 | my $tfn = catfile($Bin, $tname); |
32 | |
33 | delete $INC{$_} for ( |
5808b224 |
34 | qw/AccessorGroups.pm AccessorGroupsRO.pm AccessorGroupsSubclass.pm AccessorGroupsParent.pm AccessorGroupsWO.pm/, |
85ccab9a |
35 | File::Spec::Unix->catfile ($tfn), |
36 | ); |
37 | |
38 | local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /subroutine .+ redefined/i }; |
39 | |
40 | do($tfn); |
41 | |
ed606987 |
42 | } |
85ccab9a |
43 | } |
44 | |
45 | done_testing; |