Example #1
0
  public void testParseRepositoryExpression() throws Exception {
    testParseRepoExHelper("internal", new RepositoryExpression(new Term("internal", EMPTY_MAP)));

    testParseRepoExHelper(
        "internal(revision=1)", new RepositoryExpression("internal").atRevision("1"));

    testParseRepoExHelper(
        "file(path=\"/tmp\",projectSpace=internal)",
        new RepositoryExpression("file")
            .withOption("path", "/tmp")
            .withOption("projectSpace", "internal"));

    try {
      Parser.parseRepositoryExpression("internal(revision=1)>public");
      fail("Expression w/ translation should have failed parsing as RepositoryExpression.");
    } catch (ParseError expected) {
    }
  }
Example #2
0
 private void testParseRepoExHelper(String exString, RepositoryExpression ex) throws Exception {
   assertEquals(exString, ex.toString());
   assertEquals(ex, Parser.parseRepositoryExpression(exString));
 }