File: fork_ok_return.t

package info (click to toggle)
libtest-fork-perl 0.02-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 84 kB
  • sloc: perl: 135; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 374 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl -w

use Test::More tests => 5;

# This must come before we use Test::Fork.
my $Forked_Pid;
BEGIN {
    *CORE::GLOBAL::fork = sub () {
        return $Forked_Pid = CORE::fork;
    };
}

use Test::Fork;

is fork_ok(1, sub { pass }), $Forked_Pid, 'fork_ok() returns the child PID';
ok $Forked_Pid, '...just make sure we got a PID';
is $?, 0, 'No leak from $?';