"Fossies" - the Fresh Open Source Software Archive

Member "Apache-Session-1.93/t/99uue.t" (15 Sep 2009, 947 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 use Test::Exception;
    4 use File::Temp qw[tempdir];
    5 use Cwd qw[getcwd];
    6 
    7 #plan skip_all => "Optional module (Storable) not installed"
    8 #  unless eval {
    9 #               require Storable;
   10 #              };
   11 
   12 plan tests => 2;
   13 
   14 my $package = 'Apache::Session::Serialize::UUEncode';
   15 use_ok $package;
   16 
   17 my $origdir = getcwd;
   18 my $tempdir = tempdir( DIR => '.', CLEANUP => 1 );
   19 chdir( $tempdir );
   20 
   21 my $serial = \&Apache::Session::Serialize::UUEncode::serialize;
   22 my $unserial = \&Apache::Session::Serialize::UUEncode::unserialize;
   23 
   24 my $session = {
   25     serialized => undef,
   26     data       => undef,
   27 };
   28 my $simple  = {
   29     foo  => 1,
   30     bar  => 2,
   31     baz  => 'quux',
   32     quux => ['foo', 'bar'],
   33 };
   34 
   35 $session->{data} = $simple;
   36 
   37 &$serial($session);
   38 
   39 $session->{data} = undef;
   40 
   41 &$unserial($session);
   42 
   43 cmp_deeply($simple, $session->{data}, 'session data is correct');
   44 
   45 chdir( $origdir );