forked from RexOps/Rex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared.t
41 lines (31 loc) · 866 Bytes
/
shared.t
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
37
38
39
40
use strict;
use warnings;
BEGIN {
use Test::More tests => 9;
use_ok 'Rex::Shared::Var';
Rex::Shared::Var->import;
share(qw($scalar @array %hash));
}
$scalar = "scalar";
ok($scalar eq "scalar", "scalar test");
@array = qw(one two three four);
ok(join("-", @array) eq "one-two-three-four", "array test");
push(@array, "five");
ok($array[-1] eq "five", "array push");
%hash = (
name => "joe",
surename => "doe",
multi => {
key1 => "foo",
arr1 => [
qw/bar baz/
],
}
);
ok($hash{name} eq "joe", "hash test, key 1");
ok($hash{surename} eq "doe", "hash test, key 2");
ok($hash{multi}->{key1} eq "foo", "multidimension, key1");
ok($hash{multi}->{arr1}->[0] eq "bar", "multidimension, arr1 - key0");
ok($hash{multi}->{arr1}->[1] eq "baz", "multidimension, arr1 - key1");
unlink("vars.db");
unlink("vars.db.lock");