// Path: src/main/java/org/jparsercombinator/ParserCombinators.java
// public static ParserCombinator<String> regex(String regex) {
//   return regexMatchResult(regex).map(MatchResult::group);
// }
// 
// Path: src/main/java/org/jparsercombinator/ParserCombinators.java
// public static ParserCombinator<String> string(String str) {
//   return regex(Pattern.quote(str));
// }


import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static org.jparsercombinator.ParserCombinators.regex;
import static org.jparsercombinator.ParserCombinators.string;
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.junit.Test;
package org.jparsercombinator;



public class ParserCombinatorTest {

  private ParserCombinator<String> foo = string("foo");
  private ParserCombinator<String> bar = string("bar");

  private Parser<String> fooParser = foo.end();
  private Parser<Optional<String>> fooOptionalParser = foo.optional().end();
  private Parser<String> fooOrBarParser = foo.or(bar).end();
  private Parser<List<String>> fooRepeatingParser = foo.many().end();
  private Parser<List<String>> fooRepeatingCommaSeparatedParser = foo.many(string(",")).end();
  private Parser<Pair<String, String>> fooNextBarParser = foo.next(bar).end();
// Path: src/main/java/org/jparsercombinator/ParserCombinators.java
// public static ParserCombinator<String> regex(String regex) {
//   return regexMatchResult(regex).map(MatchResult::group);
// }
// 
// Path: src/main/java/org/jparsercombinator/ParserCombinators.java
// public static ParserCombinator<String> string(String str) {
//   return regex(Pattern.quote(str));
// }


// Path: src/test/java/org/jparsercombinator/ParserCombinatorTest.java
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static org.jparsercombinator.ParserCombinators.regex;
import static org.jparsercombinator.ParserCombinators.string;
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.junit.Test;

package org.jparsercombinator;



public class ParserCombinatorTest {

  private ParserCombinator<String> foo = string("foo");
  private ParserCombinator<String> bar = string("bar");

  private Parser<String> fooParser = foo.end();
  private Parser<Optional<String>> fooOptionalParser = foo.optional().end();
  private Parser<String> fooOrBarParser = foo.or(bar).end();
  private Parser<List<String>> fooRepeatingParser = foo.many().end();
  private Parser<List<String>> fooRepeatingCommaSeparatedParser = foo.many(string(",")).end();
  private Parser<Pair<String, String>> fooNextBarParser = foo.next(bar).end();
  private Parser<Integer> integerParser = regex("[0-9]+").map(Integer::parseInt).end();