@Test
  public void combinedIncorrectSelector() throws RecognitionException {
    String crashingSelector = "p:not*()  p:not() { }";
    ANTLRParser compiler = new ANTLRParser();
    ParseResult result = compiler.parseRuleset(crashingSelector);

    assertNoTokenMissing(crashingSelector, result.getTree(), -1);
  }
  @Test
  public void simpleIncorrectSelector() throws RecognitionException {
    String crashingSelector = "p:not*()";
    ANTLRParser compiler = new ANTLRParser();
    ParseResult result = compiler.parseSelector(crashingSelector);

    assertNoTokenMissing(crashingSelector, result.getTree(), 0);
  }
  @Test
  public void stylesheet() throws RecognitionException {
    String crashingSelector = "p:not([class**=\"lead\"]) {\n  color: black;\n}";
    ANTLRParser compiler = new ANTLRParser();
    ParseResult result = compiler.parseStyleSheet(crashingSelector);

    // the -3 is correct, even if it seems like huge hack. It sort of is.
    // RBRACE }; LBRACE {; RBRACKET ] and LBRACKET [ are (correctly thrown away)
    // and one dummy node EMPTY_COMBINATOR is added during the translation.
    // therefore there are -3 dummy nodes
    // this way of testing malformed trees is bad anyway,this needs to be changed
    // for something more readable and stable. (These tests are broken with each tree change)
    assertNoTokenMissing(crashingSelector, result.getTree(), -5);
  }
  private String doCompile(String lessContent) throws Less4jException {

    ANTLRParser.ParseResult result = parser.parseStyleSheet(lessContent);
    if (result.hasErrors()) {
      CompilationResult compilationResult =
          new CompilationResult("Errors during parsing phase, partial result is not available.");
      throw new Less4jException(result.getErrors(), compilationResult);
    }
    StyleSheet lessStyleSheet = astBuilder.parse(result.getTree());
    ASTCssNode cssStyleSheet = compiler.compileToCss(lessStyleSheet);

    CssPrinter builder = new CssPrinter();
    builder.append(cssStyleSheet);
    return builder.toString();
  }