From e42c505f54ac2e7b2ca7d0197304cac1b4f605e9 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Thu, 16 Apr 2020 10:44:21 -0700 Subject: Import 'regex' package vesion 1.3.6 * Add OWNERS * No Android.bp yet Bug: 152884384 Test: make Change-Id: I455caf7833b6c437c1c133bc7b2f47b83da9cbce --- tests/shortest_match.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/shortest_match.rs (limited to 'tests/shortest_match.rs') diff --git a/tests/shortest_match.rs b/tests/shortest_match.rs new file mode 100644 index 0000000..f8b4fed --- /dev/null +++ b/tests/shortest_match.rs @@ -0,0 +1,14 @@ +macro_rules! shortmat { + ($name:ident, $re:expr, $text:expr, $shortest_match:expr) => { + #[test] + fn $name() { + let text = text!($text); + let re = regex!($re); + assert_eq!($shortest_match, re.shortest_match(text)); + } + }; +} + +shortmat!(t01, r"a+", r"aa", Some(1)); +// Test that the reverse suffix optimization gets it right. +shortmat!(t02, r".*(?:abcd)+", r"abcdabcd", Some(4)); -- cgit v1.2.3