CWB

 view release on metacpan or  search on metacpan

t/33_cqp_errors.t  view on Meta::CPAN

syntax_error("A = 'the' ()* 'elephant'", "empty parentheses", qr/syntax error/i); # T3
syntax_error("A = 'the' [pos='NNS?']?? 'elephant'", "double quantifier", qr/syntax error/i);
syntax_error("A = 'the' (?: [pos='NNS?'])* 'elephant'", "non-capturing group", qr/syntax error/i);

# invalid repetition counts should raise errors (rather than give wrong results or crash CQP)
for my $R (-1, -2, -42) { # T6–T8
  syntax_error("A = 'the' []{$R} 'elephant'", "negative repetition count {$R}", qr/non-negative/i);
}

for my $R (-1, -2) { # T9–T10
  syntax_error("A = 'the' []{0,$R} 'elephant'", "invalid endpoint of repetition range {0,$R}", qr/non-negative/i);
}

for my $R (1, 2, 3) { # T11–T13
  my $R1 = $R - 1;
  syntax_error("A = 'the' []{$R,$R1} 'elephant'", "invalid repetition range {$R,$R1}", qr/invalid.*range/i);
}

# correspondingly for TAB queries
for my $R (-1, -2, -42) { # T14–T16
  syntax_error("A = TAB 'the' []{$R} 'elephant'", "negative distance {$R} in TAB query", qr/non-negative/i);
}

for my $R (-1, -2) { # T17–T18
  syntax_error("A = TAB 'the' []{0,$R} 'elephant'", "invalid endpoint of distance range {0,$R} in TAB query", qr/non-negative/i);
}

for my $R (-1, -2) { # T19–T20
  syntax_error("A = TAB 'the' []{,$R} 'elephant'", "invalid endpoint of distance range {,$R} in TAB query", qr/non-negative|invalid.*range/i);
}

for my $R (1, 2, 3) { # T21–T23
  my $R1 = $R - 1;
  syntax_error("A = TAB 'the' []{$R,$R1} 'elephant'", "invalid distance range ($R,$R1) in TAB query", qr/invalid.*range/i);
}

# unsupported inequality comparisons for strings and regexp raise errors
syntax_error("A = [lemma >= 'elephant']", "inequality comparison >= for p-attribute", qr/inequality/i); # T24
syntax_error("A = [lemma < 'elephant']", "inequality comparison < for p-attribute", qr/inequality/i);

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.151 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )