xref: /openbsd-src/gnu/usr.bin/perl/dist/threads/t/version.t (revision f2a19305cfc49ea4d1a5feb55cd6c283c6f1e031)
1use strict;
2use warnings;
3use Test::More;
4
5BEGIN {
6    use Config;
7    if (! $Config{'useithreads'}) {
8        print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
9        exit(0);
10    }
11}
12
13use threads;
14
15# test that the version documented in threads.pm pod matches
16# that of the code.
17
18open my $fh, "<", $INC{"threads.pm"}
19    or die qq(Failed to open '$INC{"threads.pm"}': $!);
20my $file= do { local $/; <$fh> };
21close $fh;
22my $pod_version = 0;
23if ($file=~/This document describes threads version (\d.\d+)/) {
24    $pod_version = $1;
25}
26is($pod_version, $threads::VERSION,
27   "Check that pod and \$threads::VERSION match");
28done_testing();
29
30
31
32