1use strict; 2use warnings; 3use Test::More qw( no_plan ); 4use Test::Exception; 5 6use_ok( 'CQL::Parser' ); 7my $parser = CQL::Parser->new(); 8 9my %tests = ( 10 'foo and' => [ 27, qr/missing term/ ], 11 'foo !' => [ 19, qr/unknown first class relation/ ], 12); 13 14## TODO: should add more errors here 15 16foreach my $test (sort keys %tests) { 17 my ($code,$regexp) = @{ $tests{$test} }; 18 19 throws_ok 20 { $parser->parse( $test ) } 21 $regexp, 22 $test; 23 24 is $parser->parseSafe( $test ), $code, "code $code"; 25} 26 27