| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
|
| 4 |
use Test::More; |
| 5 |
use Config; |
| 6 |
|
| 7 |
BEGIN |
| 8 |
{ |
| 9 |
my $will_run = 0; |
| 10 |
if ( $Config{useithreads} ) |
| 11 |
{ |
| 12 |
if ($ENV{THREAD_TEST}) |
| 13 |
{ |
| 14 |
require threads; |
| 15 |
require threads::shared; |
| 16 |
$will_run = 1; |
| 17 |
} |
| 18 |
else |
| 19 |
{ |
| 20 |
plan skip_all => "optional (set THREAD_TEST=1 to run these tests)"; |
| 21 |
} |
| 22 |
} |
| 23 |
else |
| 24 |
{ |
| 25 |
plan skip_all => "no ithreads in this Perl"; |
| 26 |
} |
| 27 |
|
| 28 |
if ($will_run) |
| 29 |
{ |
| 30 |
plan tests => 3; |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
use XML::LibXML qw(:threads_shared); |
| 35 |
|
| 36 |
# TEST |
| 37 |
ok(1, 'Loaded'); |
| 38 |
|
| 39 |
my $p = XML::LibXML->new(); |
| 40 |
|
| 41 |
# TEST |
| 42 |
ok($p, 'Parser initted.'); |
| 43 |
|
| 44 |
{ |
| 45 |
my $doc = $p->parse_string(qq{<root><foo id="1">bar</foo></root>}); |
| 46 |
my $cloned = threads::shared::shared_clone($doc); |
| 47 |
|
| 48 |
# TEST |
| 49 |
ok(1, "Shared clone"); |
| 50 |
} |