File: Test-Isolation.t

package info (click to toggle)
libfennec-perl 2.018-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 384 kB
  • sloc: perl: 2,083; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (4)
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
33
34
35
36
#!/usr/bin/perl

use Fennec parallel => 0, test_sort => 'random';
use Cwd qw(abs_path);

my $Original_Cwd;
my %Original_ENV;
before_all name => sub {
    $Original_Cwd = abs_path;
    %Original_ENV = %ENV;
    note "Before All $$ $Original_Cwd";
};

tests "ENV change 1" => sub {
    is_deeply \%Original_ENV, \%ENV;
    $ENV{FOO} = 23;
};

tests "ENV change 2" => sub {
    is_deeply \%Original_ENV, \%ENV;
    $ENV{FOO} = 42;
};

tests "chdir 1" => sub {
    note "$$ $Original_Cwd";
    is $Original_Cwd, abs_path;
    chdir "..";
};

tests "chdir 2" => sub {
    note "$$ $Original_Cwd";
    is $Original_Cwd, abs_path;
    chdir "t";
};

done_testing;