2015-05-25 23:45:15 +00:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy, regex_macros)]
|
|
|
|
|
2015-05-26 11:52:40 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate lazy_static;
|
2015-05-25 23:45:15 +00:00
|
|
|
extern crate regex;
|
|
|
|
|
2015-05-26 11:52:40 +00:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
2015-05-25 23:45:15 +00:00
|
|
|
#[test]
|
|
|
|
#[deny(mut_mut)]
|
2016-02-08 22:48:04 +00:00
|
|
|
#[allow(regex_macro)]
|
2015-05-25 23:45:15 +00:00
|
|
|
fn test_regex() {
|
2015-08-11 18:22:20 +00:00
|
|
|
let pattern = regex!(r"^(?P<level>[#]+)\s(?P<title>.+)$");
|
|
|
|
assert!(pattern.is_match("# headline"));
|
2015-05-25 23:45:15 +00:00
|
|
|
}
|
2015-05-26 11:52:40 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[deny(mut_mut)]
|
|
|
|
#[allow(unused_variables, unused_mut)]
|
|
|
|
fn test_lazy_static() {
|
2015-08-11 18:22:20 +00:00
|
|
|
lazy_static! {
|
|
|
|
static ref MUT_MAP : HashMap<usize, &'static str> = {
|
|
|
|
let mut m = HashMap::new();
|
|
|
|
let mut zero = &mut &mut "zero";
|
|
|
|
m.insert(0, "zero");
|
|
|
|
m
|
|
|
|
};
|
|
|
|
static ref MUT_COUNT : usize = MUT_MAP.len();
|
|
|
|
}
|
|
|
|
assert!(*MUT_COUNT == 1);
|
2015-05-26 11:52:40 +00:00
|
|
|
}
|