/[Frey]/branches/no-pager/t/02-frey-sql.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 /branches/no-pager/t/02-frey-sql.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 702 - (hide annotations)
Wed Dec 3 21:12:43 2008 UTC (15 years, 5 months ago) by dpavlin
File MIME type: application/x-troff
File size: 691 byte(s)
branch for no-pager integration
1 dpavlin 370 #!/usr/bin/perl
2     use strict;
3     use warnings;
4    
5     my $debug = @ARGV ? 1 : 0;
6    
7     use Test::More tests => 7;
8     use lib 'lib';
9    
10     use Data::Dump qw/dump/;
11    
12     BEGIN {
13     use_ok('Frey::SQL');
14     }
15    
16     my $sql = 'select id, a from sponge';
17    
18     eval { Frey::SQL->new() };
19     ok( $@, 'no sponge' );
20     diag $@ if $debug;
21    
22     my $rows = [
23     [ 1, 'foo' ],
24     [ 2, 'foo' ],
25     [ 3, 'bar' ],
26     ];
27    
28     ok( my $o = Frey::SQL->new(
29     query => $sql,
30     sponge => {
31     NAME => [ 'id', 'a' ],
32     rows => $rows,
33     },
34     debug => $debug,
35     ), "new" );
36    
37     ok( my $query = $o->query, 'query' );
38     diag dump( $query ) if $debug;
39     cmp_ok( $query, 'eq', $sql, $sql );
40    
41 dpavlin 455 ok( my $data = $o->as_data, 'data' );
42 dpavlin 370 diag dump( $data ) if $debug;
43     is_deeply( $data, $rows, 'got rows' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26