3 # test per-interpeter static data API (MY_CXT)
10 push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
11 require Config; import Config;
12 if ($Config{'extensions'} !~ /\bXS\/APItest\b/) {
13 # Look, I'm using this fully-qualified variable more than once!
14 my $arch = $MacPerl::Architecture;
15 print "1..0 # Skip: XS::APItest was not built\n";
18 $threads = $Config{'useithreads'};
19 # must 'use threads' before 'use Test::More'
20 eval 'use threads' if $threads;
26 use Test::More tests => 16;
29 use_ok('XS::APItest');
32 is(my_cxt_getint(), 99, "initial int value");
33 is(my_cxt_getsv($_), "initial", "initial SV value$_")
34 foreach '', ' (context arg)';
37 is(my_cxt_getint(), 1234, "new int value");
40 is(my_cxt_getsv($_), "abcd", "new SV value$_")
41 foreach '', ' (context arg)';
44 is(my_cxt_getint(), 1234, "initial int value (child)");
46 is(my_cxt_getint(), 4321, "new int value (child)");
48 is(my_cxt_getsv($_), "initial_clone", "initial sv value (child)$_")
49 foreach '', ' (context arg)';
51 is(my_cxt_getsv($_), "dcba", "new SV value (child)$_")
52 foreach '', ' (context arg)';
56 skip "No threads", 6 unless $threads;
57 threads->create(\&do_thread)->join;
60 is(my_cxt_getint(), 1234, "int value preserved after join");
61 is(my_cxt_getsv($_), "abcd", "SV value preserved after join$_")
62 foreach '', ' (context arg)';