MCPcopy Create free account
hub / github.com/google/re2j / testDocumentedExample

Method testDocumentedExample

javatests/com/google/re2j/MatcherTest.java:426–445  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

424
425 // This example is documented in the com.google.re2j package.html.
426 @Test
427 public void testDocumentedExample() {
428 Pattern p = Pattern.compile("b(an)*(.)");
429 Matcher m = p.matcher("by, band, banana");
430 assertTrue(m.lookingAt());
431 m.reset();
432 assertTrue(m.find());
433 assertEquals("by", m.group(0));
434 assertNull(m.group(1));
435 assertEquals("y", m.group(2));
436 assertTrue(m.find());
437 assertEquals("band", m.group(0));
438 assertEquals("an", m.group(1));
439 assertEquals("d", m.group(2));
440 assertTrue(m.find());
441 assertEquals("banana", m.group(0));
442 assertEquals("an", m.group(1));
443 assertEquals("a", m.group(2));
444 assertFalse(m.find());
445 }
446
447 @Test
448 public void testMutableCharSequence() {

Callers

nothing calls this directly

Calls 6

compileMethod · 0.95
matcherMethod · 0.95
lookingAtMethod · 0.95
resetMethod · 0.95
findMethod · 0.95
groupMethod · 0.95

Tested by

no test coverage detected