File: 01_load_signal_arg.t

package info (click to toggle)
libmce-perl 1.517-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,864 kB
  • ctags: 377
  • sloc: perl: 10,516; makefile: 2
file content (32 lines) | stat: -rwxr-xr-x 914 bytes parent folder | download
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
32
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More tests => 3;

## Default is $MCE::Signal::tmp_dir which points to $ENV{TEMP} if defined.
## Otherwise, pass argument to module wanting /dev/shm versus /tmp for
## temporary files. MCE::Signal falls back to /tmp unless /dev/shm exists.
##
## One optional argument not tested here is -keep_tmp_dir which omits the
## removal of $tmp_dir on exit. A message is displayed by MCE::Signal stating
## the location of $tmp_dir when exiting.
##
## Always load MCE::Signal before MCE when wanting to export or pass options.

our $tmp_dir;

BEGIN {
   use_ok('MCE::Signal', qw( $tmp_dir -use_dev_shm ));

   if (! exists $ENV{TEMP} && -d '/dev/shm' && -w '/dev/shm') {
      ok($tmp_dir =~ m!^/dev/shm/!, 'Check tmp_dir matches ^/dev/shm/');
   }
   else {
      ok($tmp_dir !~ m!^/dev/shm/!, 'Check tmp_dir does not match ^/dev/shm/');
   }

   use_ok('MCE');
}