/[Frey]/trunk/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

Annotation of /trunk/t/01-frey-storage.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 561 - (hide annotations)
Thu Nov 27 21:04:04 2008 UTC (15 years, 4 months ago) by dpavlin
File MIME type: application/x-troff
File size: 994 byte(s)
move test data to var/t/
1 dpavlin 151 #!/usr/bin/perl
2     use strict;
3     use warnings;
4    
5     use Test::More tests => 13;
6     use lib 'lib';
7    
8     use Data::Dump qw/dump/;
9    
10 dpavlin 532 my $debug = @ARGV ? 1 : 0;
11 dpavlin 151
12     BEGIN {
13     use_ok('Frey::Storage');
14     use_ok('Frey');
15     }
16    
17     {
18     package Mock;
19     use Moose;
20     extends 'Frey';
21     with 'Frey::Storage';
22     }
23    
24     isa_ok( Frey::Storage->meta, 'Moose::Meta::Role' );
25    
26    
27     ok( my $o = Mock->new( debug => $debug ), 'new' );
28     diag $o->dump(2) if $debug;
29    
30     my $data = { foo => 'bar' };
31 dpavlin 561 my $path = 'var/t/Frey.Storeage.yaml';
32 dpavlin 151
33     ok( $o->store( $path, $data ), 'store' );
34    
35     ok( my $data2 = $o->load( $path ), 'load' );
36    
37     diag dump( $data, $data2 ) if $debug;
38     is_deeply( $data, $data2, 'same' );
39    
40     ok( ! $o->reload( $path ), 'no reload' );
41    
42     sleep 1;
43    
44     $data->{baz} = 42;
45     ok( $o->store( $path, $data ), 'store again' );
46    
47 dpavlin 153 ok( my $new = $o->reload( $path ), 'reload' );
48 dpavlin 151
49     diag dump( $data, $new ) if $debug;
50     is_deeply( $data, $new, 'same' );
51    
52 dpavlin 153 ok( ! $o->reload( $path ), 'no reload' );
53    
54     ok( ! $o->load( 'var/something.which.doesnt.exist' ), 'load without file' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26