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