/[Frey]/trunk/t/02-frey-sql.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/t/02-frey-sql.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 455 - (show annotations)
Wed Nov 19 15:28:23 2008 UTC (15 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 691 byte(s)
rename invocable events with prefix as_ with fallback in Frey::Web

This started with brute-force rename using:

  perl -p -i -n -e 's/sub markup/sub as_markup/'  `grep -lr 'sub markup' lib t`
  perl -p -i -n -e 's/sub data/sub as_data/'      `grep -lr 'sub data' lib t`
  perl -p -i -n -e 's/sub sponge/sub as_sponge/'  `grep -lr 'sub sponge' lib t`

  perl -p -i -n -e 's/->markup/->as_markup/'      `grep -lr -- '->markup' lib t`
  perl -p -i -n -e 's/->data/->as_data/'          `grep -lr -- '->data' lib t`
  perl -p -i -n -e 's/->sponge/->as_sponge/'      `grep -lr -- '->sponge' lib t`

  perl -p -i -n -e 's!/markup!/as_markup!'        `grep -lr -- '/markup' lib t etc`
  perl -p -i -n -e 's!/data!/as_data!'            `grep -lr -- '/data' lib t etc`
  perl -p -i -n -e 's!/sponge!/as_sponge!'        `grep -lr -- '/sponge' lib t etc`

1 #!/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 ok( my $data = $o->as_data, 'data' );
42 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