File: threads.t

package info (click to toggle)
libboolean-perl 0.46-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 144 kB
  • ctags: 11
  • sloc: perl: 77; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 663 bytes parent folder | download | duplicates (2)
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
use Test::More;
use strict;
use lib 'lib';

use Config;
BEGIN { plan skip_all => "requires threads" unless $Config{usethreads} };

use threads;

plan tests => 8;

use boolean ':all';

my $true = true;
my $false = false;

sub ok_from_thread($) {
    local $Test::Builder = $Test::Builder::Level + 1;
    my $code = shift;
    ok( threads->create(eval "sub { $code }")->join(), $code );
};

ok_from_thread "isTrue(true)";
ok_from_thread "isFalse(false)";
ok_from_thread "isBoolean(true)";
ok_from_thread "isBoolean(false)";
ok_from_thread "isTrue(\$true)";
ok_from_thread "isFalse(\$false)";
ok_from_thread "isBoolean(\$true)";
ok_from_thread "isBoolean(\$false)";