File: new_with_undef.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 (45 lines) | stat: -r--r--r-- 986 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/perl

use strict;
use warnings;

use CGI;
use CGI::Session;
use Test::More tests => 6;

# ---------------

{
my($session) = CGI::Session -> new(undef);

isa_ok($session, 'CGI::Session', 'new(undef) returns an object which');

my($id) = $session -> id();

isnt($id, undef, "new(undef)'s session object returns an id which is /not/ undef");
}

{
my($q)       = CGI -> new();
my($session) = CGI::Session -> new($q);

isa_ok($session, 'CGI::Session', 'new($q without CGISESSID) returns an object which');

my($id) = $session -> id();

isnt($id, undef, "new(\$q without CGISESSID)'s session object returns an id which is /not/ undef");
}

{
my($q) = CGI -> new();

$q -> param(CGISESSID => 'Purple cats is weird');

my($session) = CGI::Session -> new($q);

isa_ok($session, 'CGI::Session', 'new($q with fake CGISESSID) returns an object which');

my($id) = $session -> id();

isnt($id, undef, "new(\$q with fake CGISESSID)'s session object returns an id which is /not/ undef");
}