1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 3;
7use Test::Exception;
8
9
10{
11    package MyLimit;
12    use base 'SQL::Abstract::Limit';
13    sub emulate_limit { 'yah' }
14}
15
16my ( $sql, $stmt );
17
18lives_ok { $sql = MyLimit->new; $stmt = $sql->select( 'table',
19                                                      [ 'col1', 'col2' ],
20                                                      { this => 'that' },
21                                                      [ 'col3 ASC' ],
22                                                      10,
23                                                      100,
24                                                      ) } 'my own limit';
25
26like( $stmt, qr(^yah$), 'custom LIMIT' );
27
28$stmt = $sql->select( 'table',
29                      [ 'col1', 'col2' ],
30                      { this => 'that' },
31                      );
32
33like( $stmt, qr(^\QSELECT col1, col2 FROM table WHERE ( this = ? )\E$), 'SQL::Abstract - no limit' );
34