1 macro_rules! shortmat { 2 ($name:ident, $re:expr, $text:expr, $shortest_match:expr) => { 3 #[test] 4 fn $name() { 5 let text = text!($text); 6 let re = regex!($re); 7 assert_eq!($shortest_match, re.shortest_match(text)); 8 } 9 }; 10 } 11 12 shortmat!(t01, r"a+", r"aa", Some(1)); 13 // Test that the reverse suffix optimization gets it right. 14 shortmat!(t02, r".*(?:abcd)+", r"abcdabcd", Some(4)); 15