DBIx-Custom / t / dbix-custom-query.t /
Newer Older
37 lines | 1.018kb
packaging one directory
yuki-kimoto authored on 2009-11-16
1
use Test::More 'no_plan';
2

            
3
use strict;
4
use warnings;
5
use DBIx::Custom::Query;
6

            
7
# Function for test name
8
my $test;
9
sub test{
10
    $test = shift;
11
}
12

            
13
# Variables for test
14
my $query;
15

            
16
test 'Accessors';
17
$query = DBIx::Custom::Query->new(
18
    sql              => 'a',
19
    key_infos        => 'b',
20
    bind_filter      => 'c',
21
    no_bind_filters  => [qw/d e/],
22
    sth              => 'e',
23
    fetch_filter     => 'f',
24
    no_fetch_filters => [qw/g h/],
25
);
26

            
27
is($query->sql, 'a', "$test : sql");
28
is($query->key_infos, 'b', "$test : key_infos ");
29
is($query->bind_filter, 'c', "$test : bind_filter");
30
is_deeply(scalar $query->no_bind_filters, [qw/d e/], "$test : no_bind_filters");
31
is_deeply(scalar $query->_no_bind_filters_map, {d => 1, e => 1}, "$test : _no_bind_filters_map");
32
is_deeply(scalar $query->no_fetch_filters, [qw/g h/], "$test : no_fetch_filters");
33
is($query->sth, 'e', "$test : sth");
34

            
35
$query->no_bind_filters(undef);
36
is_deeply(scalar $query->_no_bind_filters_map, {}, "$test _no_bind_filters_map undef value");
37