Package net.rootnode.loomchild.util.io

Examples of net.rootnode.loomchild.util.io.ReaderCharSequence


  private static final Pattern REGEX = Pattern.compile(" - ");

  @Test
  public void testSimple() {
    StringReader reader = new StringReader(REGEX_DATA);
    CharSequence text = new ReaderCharSequence(reader);
    ReaderMatcher matcher = new ReaderMatcher(REGEX, text);
    boolean found;
    found = matcher.find();
    assertTrue(found);
    assertEquals(5, matcher.start());
View Full Code Here


  private static final Pattern REGEX_WHOLE = Pattern.compile(".*");

  @Test
  public void testWhole() {
    StringReader reader = new StringReader(REGEX_DATA);
    CharSequence text = new ReaderCharSequence(reader);
    ReaderMatcher matcher = new ReaderMatcher(REGEX_WHOLE, text);
    boolean found = matcher.find();
    assertTrue(found);
    assertEquals(REGEX_DATA, matcher.group());
  }
View Full Code Here

  private static final Pattern REGEX_ALTERNATIVE = Pattern.compile("b|bc");

  @Test
  public void testAlternative() {
    StringReader reader = new StringReader(REGEX_DATA);
    CharSequence text = new ReaderCharSequence(reader);
    ReaderMatcher matcher = new ReaderMatcher(REGEX_ALTERNATIVE, text);
    boolean found = matcher.find();
    assertTrue(found);
    assertEquals(1, matcher.start());
    assertEquals(2, matcher.end());
View Full Code Here

  private static final Pattern REGEX_LOOKING_AT = Pattern.compile("bcd");

  @Test
  public void testLookingAt() {
    StringReader reader = new StringReader(REGEX_DATA);
    CharSequence text = new ReaderCharSequence(reader);
    ReaderMatcher matcher = new ReaderMatcher(REGEX_LOOKING_AT, text);
    matcher.region(1, text.length());
    assertTrue(matcher.lookingAt());
    matcher.region(2, text.length());
    assertFalse(matcher.lookingAt());
  }
View Full Code Here

TOP

Related Classes of net.rootnode.loomchild.util.io.ReaderCharSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.