try to make t/306_is_class_loaded.t skip except when it is meaningful
[gitmo/Class-MOP.git] / t / 306_is_class_loaded.t
1 use strict;
2 use warnings;
3
4 use FindBin qw/$Bin/;
5 use lib "$Bin/lib";
6
7 use Test::More;
8 use Class::MOP ();
9
10 plan 'skip_all' => 'This test is only meaningful for an XS-enabled CMOP with Perl < 5.10'
11     unless Class::MOP::USING_XS() && ! Class::MOP::IS_RUNNING_ON_5_10();
12
13 plan tests => 1;
14
15 # With pre-5.10 Perl, just defining this sub appears to shit in
16 # TestClassLoaded's symbol tables (see the SCALAR package symbol you
17 # end up with).  This confuses the XS is_class_loaded method, which
18 # looks for _any_ symbol, not just code symbols of VERSION/AUTHORITY
19 # etc.
20
21 sub whatever {
22     TestClassLoaded::this_method_does_not_even_exist();
23 }
24
25 Class::MOP::load_class('TestClassLoaded');
26
27 TODO: {
28     local $TODO = 'The XS is_class_loaded is confused by the bogus method defined in whatever()';
29     ok(
30         TestClassLoaded->can('a_method'),
31         'TestClassLoader::a_method is defined'
32     );
33 }
34