This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Digest::MD5 from version 2.40 to 2.50
[perl5.git] / cpan / Digest-MD5 / t / threads.t
CommitLineData
62d37bf0
FR
1use strict;
2use warnings;
3use Test::More;
4use Config;
5
6BEGIN {
7 plan skip_all => 'Perl compiled without ithreads'
8 unless $Config{useithreads};
9 plan tests => 2;
10}
11
12use threads;
13use Digest::MD5;
14
15my $module = 'Digest::MD5';
16
17my $obj = $module->new;
18$obj->add("foo");
19my $tdigest = threads->create(sub { $obj->add("bar"); $obj->hexdigest })->join;
20
21isnt $obj->clone->hexdigest, $tdigest, "unshared object unaffected by the thread";
22
23$obj->add("bar");
24is $obj->clone->hexdigest, $tdigest;