summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/dist/threads/t/version.t
blob: fb9130903aa8d281ec59b1a028f6ef7e19e6cafe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;
use Test::More;

BEGIN {
    use Config;
    if (! $Config{'useithreads'}) {
        print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
        exit(0);
    }
}

use threads;

# test that the version documented in threads.pm pod matches
# that of the code.

open my $fh, "<", $INC{"threads.pm"}
    or die qq(Failed to open '$INC{"threads.pm"}': $!);
my $file= do { local $/; <$fh> };
close $fh;
my $pod_version = 0; 
if ($file=~/This document describes threads version (\d.\d+)/) {
    $pod_version = $1;
}
is($pod_version, $threads::VERSION, 
   "Check that pod and \$threads::VERSION match");
done_testing();