summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/ext/POSIX/t/strerror_errno.t
blob: df691f177f08b6ed19f3a48fd8a6b5c873558787 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use Config;
use Test::More;

# This is placed in a separate file, as some 'requires' and 'uses' are known
# to cause it to not fail even with the bug it's testing still being
# broken.  [perl #123503].

plan(skip_all => "POSIX is unavailable")
    unless $Config{extensions} =~ /\bPOSIX\b/;

require POSIX;

$! = 1;
POSIX::strerror(1);
is (0+$!, 1, 'strerror doesn\'t destroy $!');

# [perl #126229] POSIX::strerror() clears $!
{
    local $! = 29;
    my $e = POSIX::strerror($!);
    is (0+$!, 29);
}

done_testing();