rust/tests/compile-fail/regex.rs

25 lines
585 B
Rust
Raw Normal View History

2016-02-04 17:36:06 -06:00
#![feature(plugin)]
#![plugin(clippy)]
#![allow(unused)]
#![deny(invalid_regex)]
extern crate regex;
use regex::Regex;
2016-02-05 09:48:35 -06:00
const OPENING_PAREN : &'static str = "(";
2016-02-04 17:36:06 -06:00
fn main() {
let pipe_in_wrong_position = Regex::new("|");
//~^ERROR: Regex syntax error: empty alternate
2016-02-05 09:48:35 -06:00
let wrong_char_ranice = Regex::new("[z-a]");
2016-02-04 17:36:06 -06:00
//~^ERROR: Regex syntax error: invalid character class range
2016-02-05 09:48:35 -06:00
let some_regex = Regex::new(OPENING_PAREN);
//~^ERROR: Regex syntax error on position 0: unclosed
let closing_paren = ")";
let not_linted = Regex::new(closing_paren);
2016-02-04 17:36:06 -06:00
}