File: SQLQueryTypeTest.pm

package info (click to toggle)
lire 2%3A2.0.2-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 13,480 kB
  • ctags: 5,059
  • sloc: perl: 61,803; xml: 18,361; sh: 1,834; makefile: 1,359
file content (40 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (5)
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
34
35
36
37
38
39
40
package tests::SQLQueryTypeTest;

use base qw/Lire::Test::DlfAnalyserTestCase/;

use Lire::DlfAnalysers::SQLQueryType;
use File::Basename;

sub schemasdir {
    return dirname( __FILE__ ) . "/../..";
}

sub create_analyser {
    return new Lire::DlfAnalysers::SQLQueryType();
}

sub registration_file {
    return dirname( __FILE__ ) . "/../../querytype_init";
}

sub test_categorise {
    my $self = $_[0];

    my $analyser = $self->create_analyser();
    my $dlf = { 'query' => undef };
    $analyser->categorise( $dlf );
    $self->assert_null( $dlf->{'querytype'} );

    $dlf = { 'query' => '   select test from test'  };
    $analyser->categorise( $dlf );
    $self->assert_str_equals( 'SELECT', $dlf->{'querytype'} );

    $dlf = { 'query' => 'UPDATE test SET test=1'  };
    $analyser->categorise( $dlf );
    $self->assert_str_equals( 'UPDATE', $dlf->{'querytype'} );

    return;
}


1;