/[Frey]/branches/zimbardo/t/01-Frey-Storage.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/zimbardo/t/01-Frey-Storage.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/t/01-frey-storage.t revision 151 by dpavlin, Wed Jul 16 23:04:22 2008 UTC branches/zimbardo/t/01-Frey-Storage.t revision 1189 by dpavlin, Mon Sep 28 20:23:45 2009 UTC
# Line 2  Line 2 
2  use strict;  use strict;
3  use warnings;  use warnings;
4    
5  use Test::More tests => 13;  use Test::More tests => 21;
6  use lib 'lib';  use lib 'lib';
7    
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9    
10  my $debug = 1 if @ARGV;  my $debug = @ARGV ? 1 : 0;
11    
12  BEGIN {  BEGIN {
13          use_ok('Frey::Storage');          use_ok('Frey::Storage');
# Line 27  isa_ok( Frey::Storage->meta, 'Moose::Met Line 27  isa_ok( Frey::Storage->meta, 'Moose::Met
27  ok( my $o = Mock->new( debug => $debug ), 'new' );  ok( my $o = Mock->new( debug => $debug ), 'new' );
28  diag $o->dump(2) if $debug;  diag $o->dump(2) if $debug;
29    
30    foreach my $path ( map { "var/t/Frey.Storage.$_" } ( 'yaml', 'storable' ) ) {
31    
32    diag $path;
33    
34  my $data = { foo => 'bar' };  my $data = { foo => 'bar' };
 my $path = 'var/test.Frey.Storeage';  
35    
36  ok( $o->store( $path, $data ), 'store' );  ok( $o->store( $path, $data ), 'store' );
37    
# Line 44  sleep 1; Line 47  sleep 1;
47  $data->{baz} = 42;  $data->{baz} = 42;
48  ok( $o->store( $path, $data ), 'store again' );  ok( $o->store( $path, $data ), 'store again' );
49    
50  my $new;  ok( my $new = $o->reload( $path ), 'reload' );
 ok( $o->reload( $path, \$new ), 'reload' );  
51    
52  diag dump( $data, $new ) if $debug;  diag dump( $data, $new ) if $debug;
53  is_deeply( $data, $new, 'same' );  is_deeply( $data, $new, 'same' );
54    
55  my $keep = { 'test' => 'data' };  ok( ! $o->reload( $path ), 'no reload' );
56  my $new2 = $keep;  
57  ok( ! $o->reload( $path, \$new2 ), 'reload' );  } # foreach
58  is_deeply( $keep, $new2, 'same' );  
59    ok( ! $o->load( 'var/something.which.doesnt.exist' ), 'load without file' );

Legend:
Removed from v.151  
changed lines
  Added in v.1189

  ViewVC Help
Powered by ViewVC 1.1.26