fixup pattern
@@ -28,7 +28,7 @@ impl Pattern for &str {
impl Pattern for &Regex {
fn find_matches(&self, inside: &str) -> Result<Vec<(Offsets, bool)>> {
if inside.is_empty() {
- return Ok(vec![]);
+ return Ok(vec![((0, 0), false)]);
}
// Find initial matches
@@ -69,7 +69,7 @@ where
{
fn find_matches(&self, inside: &str) -> Result<Vec<(Offsets, bool)>> {
if inside.is_empty() {
- return Ok(vec![]);
+ return Ok(vec![((0, 0), false)]);
}
let mut last_offset = 0;
@@ -145,7 +145,7 @@ mod tests {
do_test!("aba", 'a' => vec![((0, 1), true), ((1, 2), false), ((2, 3), true)]);
do_test!("bbbba", 'a' => vec![((0, 4), false), ((4, 5), true)]);
do_test!("aabbb", 'a' => vec![((0, 1), true), ((1, 2), true), ((2, 5), false)]);
- do_test!("", 'a' => vec![]);
+ do_test!("", 'a' => vec![((0, 0), false)]);
}
#[test]
@@ -157,7 +157,7 @@ mod tests {
do_test!("aabbab", "ab" =>
vec![((0, 1), false), ((1, 3), true), ((3, 4), false), ((4, 6), true)]
);
- do_test!("", "" => vec![]);
+ do_test!("", "" => vec![((0, 0), false)]);
}
#[test]
@@ -166,7 +166,7 @@ mod tests {
do_test!("aba", is_b => vec![((0, 1), false), ((1, 2), true), ((2, 3), false)]);
do_test!("aaaab", is_b => vec![((0, 4), false), ((4, 5), true)]);
do_test!("bbaaa", is_b => vec![((0, 1), true), ((1, 2), true), ((2, 5), false)]);
- do_test!("", is_b => vec![]);
+ do_test!("", is_b => vec![((0, 0), false)]);
}
#[test]
@@ -176,6 +176,6 @@ mod tests {
do_test!(" a b ", &is_whitespace =>
vec![((0, 3), true), ((3, 4), false), ((4, 7), true), ((7, 8), false), ((8, 11), true)]
);
- do_test!("", &is_whitespace => vec![]);
+ do_test!("", &is_whitespace => vec![((0, 0), false)]);
}
}
