File: expire.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 (39 lines) | stat: -r--r--r-- 809 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
# $Id$

use strict;


use Test::More qw/no_plan/;

# Tests for expire(), which doesn't directly use driver-specific code. 

use CGI::Session;
my $s = CGI::Session->new();

is($s->expire, undef, "undef is returned if nothing has been set yet. ");

$s->expire(10);
is($s->expire, 10, "basic set/get check");

$s->expire(-10);
is($s->expire, -10, "negative set/get check");

$s->expire(0);
is($s->expire, undef, "zero cancels expiration");

$s->expire('pumpkin',10);

# reach into internals to test
is($s->{_DATA}{_SESSION_EXPIRE_LIST}{'pumpkin'}, 10 , "setting expiration for a single param works");


$s->expire('pumpkin', 0);
ok(!exists($s->{_DATA}->{_SESSION_EXPIRE_LIST}->{'pumpkin'}), "zero expires parameters");

#
# Let's cleanup after ourselves
$s->delete;

# more related tests are in t/str2second.t