File: g4_dbfile_yaml.t

package info (click to toggle)
libcgi-session-serialize-yaml-perl 4.26-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 92 kB
  • ctags: 3
  • sloc: perl: 20; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 1,169 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
# $Id$

use strict;
use diagnostics;

use Test::More;
use File::Spec;
use CGI::Session::Test::Default;

our %serializers;

our %options = (
    'YAML'            =>  {   },
    'YAML::Syck'      =>  { skip    =>  [101]   },
);

plan skip_all => 'DB_File is NOT available' unless eval { require DB_File };

foreach my $i (keys(%options)) {
    $serializers{$i}++ if eval "use $i (); 1";
}

delete $serializers{YAML} if exists $serializers{YAML} && YAML->VERSION < 0.58;

unless(%serializers) {
    plan skip_all => "Neither YAML or YAML::Syck are available";
}

my @test_objects;

while(my($k, $v) = each(%serializers)) {
    push(@test_objects, CGI::Session::Test::Default->new(
        dsn => "d:DB_File;s:YAML;id:md5",
        args => {
            FileName => File::Spec->catfile('t', 'sessiondata', 'cgisess.db'),
        },
        %{$options{$k}},
        __testing_serializer => $k,
    ));
}

my $tests = 0;
$tests += $_->number_of_tests foreach @test_objects;
plan tests => $tests;

foreach my $to (@test_objects) {
    $CGI::Session::Serialize::yaml::Flavour = $to->{__testing_serializer};
    diag($CGI::Session::Serialize::yaml::Flavour);
    $to->run();
}