"Fossies" - the Fresh Open Source Software Archive

Member "Apache-Session-1.93/t/99base64.t" (15 Sep 2009, 878 Bytes) of package /linux/www/Apache-Session-1.93.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 use Test::More;
    2 use Test::Deep;
    3 
    4 plan skip_all => "Optional modules (MIME::Base64) not installed"
    5   unless eval {
    6                require MIME::Base64;
    7               };
    8 
    9 plan tests => 3;
   10 
   11 my $package = 'Apache::Session::Serialize::Base64';
   12 use_ok $package;
   13 can_ok $package, qw[serialize unserialize];
   14 
   15 my $serialize   = \&{"$package\::serialize"};
   16 my $unserialize = \&{"$package\::unserialize"};
   17 
   18 my $session = {
   19                serialized => undef,
   20                data       => undef,
   21               };
   22 my $simple  = {
   23                foo  => 1,
   24                bar  => 2,
   25                baz  => 'quux',
   26                quux => ['foo', 'bar'],
   27               };
   28 
   29 $session->{data} = $simple;
   30 
   31 $serialize->($session);
   32 
   33 $session->{data} = undef;
   34 
   35 $unserialize->($session);
   36 
   37 cmp_deeply $session->{data}, $simple, "Session was deserialized correctly";