File: complex_ds.t

package info (click to toggle)
libcgi-session-perl 4.48-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 616 kB
  • sloc: perl: 1,920; makefile: 5
file content (56 lines) | stat: -r--r--r-- 1,093 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# $Id: complex_ds.t,v 1.2 2002/11/22 13:09:21 sherzodr Exp $

use strict;


BEGIN { 
    use Test::More tests => 10;
};


# Insert your test code below, the Test module is use()ed here so read
# its man page ( perldoc Test ) for help writing this test script.
use CGI::Session;

my $s = CGI::Session->new('driver:File',undef, {Directory=>"t"} ) or die $CGI::Session::errstr;

ok($s);
ok($s->id());

my $d1 = [qw(1 2 3 4 5 6)];
my $d2 = {1 => "Bir", 2 => "Ikki", 3=>"Uch", 4=>"To'rt", 5=>"Besh", 6=>"Olti"};
my $d3 = {
        d1 => $d1,
        d2 => $d2
};

$s->param(d3 => $d3);

ok($s->param('d3'));

ok( $s->param('d3')->{d1}->[0], 'Test 1');

ok( $s->param('d3')->{d1}->[1], 'Test 2');

ok( $s->param('d3')->{d2}->{1}, 'Bir');

my $sid = $s->id();

$s->flush();

eval { 
    my $s1 = CGI::Session->new('driver:File',$sid, {Directory=>"t"})
        or die $CGI::Session::errstr;

    ok($s1->param('d3'));

    ok( $s1->param('d3')->{d1}->[0], 'Test 1');

    ok( $s1->param('d3')->{d1}->[1], 'Test 2');

    ok( $s1->param('d3')->{d2}->{1}, 'Bir');

    $s1->delete();
};
warn $@ if $@;