File: error.t

package info (click to toggle)
libcql-parser-perl 1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 324 kB
  • sloc: perl: 2,388; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 524 bytes parent folder | download | duplicates (2)
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
use strict;
use warnings;
use Test::More qw( no_plan );
use Test::Exception;

use_ok( 'CQL::Parser' );
my $parser = CQL::Parser->new();

my %tests = (
    'foo and'  => [ 27, qr/missing term/ ],
    'foo !'    => [ 19, qr/unknown first class relation/ ],
);

## TODO: should add more errors here

foreach my $test (sort keys %tests) {
    my ($code,$regexp) = @{ $tests{$test} };

    throws_ok
        { $parser->parse( $test ) }
        $regexp,
        $test;

    is $parser->parseSafe( $test ), $code, "code $code";
}