// if you need to output something during tests // private readonly ITestOutputHelper output; // // public SpreadsheetTests(ITestOutputHelper output) // { // this.output = output; // } private void Setup(string input) { var inputStream = new AntlrInputStream(input); lexer = new SpreadsheetLexer(inputStream); var commonTokenStream = new CommonTokenStream(lexer); parser = new SpreadsheetParser(commonTokenStream); var writer = new StringWriter(); errorListener = new SpreadsheetErrorListener(writer); lexer.RemoveErrorListeners(); //markupLexer.addErrorListener(errorListener); parser.RemoveErrorListeners(); parser.AddErrorListener(errorListener); }
// if you need to output something during tests // private readonly ITestOutputHelper output; // // public SpreadsheetTests(ITestOutputHelper output) // { // this.output = output; // } private void setup(String input) { ICharStream inputStream = CharStreams.fromString(input); lexer = new SpreadsheetLexer(inputStream); CommonTokenStream commonTokenStream = new CommonTokenStream(lexer); parser = new SpreadsheetParser(commonTokenStream); StringWriter writer = new StringWriter(); errorListener = new SpreadsheetErrorListener(writer); lexer.RemoveErrorListeners(); // uncomment this if you want to see errors from the lexer //lexer.addErrorListener(errorListener); parser.RemoveErrorListeners(); parser.AddErrorListener(errorListener); }