File: 03.subclass.t

package info (click to toggle)
libsql-abstract-limit-perl 2%3A0.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 152 kB
  • sloc: perl: 531; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 3;
use Test::Exception;


{
    package MyLimit;
    use base 'SQL::Abstract::Limit';
    sub emulate_limit { 'yah' }
}

my ( $sql, $stmt );

lives_ok { $sql = MyLimit->new; $stmt = $sql->select( 'table',
                                                      [ 'col1', 'col2' ],
                                                      { this => 'that' },
                                                      [ 'col3 ASC' ],
                                                      10,
                                                      100,
                                                      ) } 'my own limit';

like( $stmt, qr(^yah$), 'custom LIMIT' );

$stmt = $sql->select( 'table',
                      [ 'col1', 'col2' ],
                      { this => 'that' },
                      );

like( $stmt, qr(^\QSELECT col1, col2 FROM table WHERE ( this = ? )\E$), 'SQL::Abstract - no limit' );