private void run(String testName, bool pretty, JadeModel model) { JadeParser parser = null; try { FileTemplateLoader loader = new FileTemplateLoader(TestFileHelper.getCompilerErrorsResourcePath(""), "UTF-8"); parser = new JadeParser(testName, loader); } catch (IOException e) { Trace.WriteLine(e); } Node root = parser.parse(); Jade.Compiler.Compiler compiler = new Jade.Compiler.Compiler(root); compiler.setPrettyPrint(pretty); String expected = readFile(testName + ".html"); model.addFilter("markdown", new MarkdownFilter()); model.addFilter("plain", new PlainFilter()); String html; try { html = compiler.compileToString(model); Assert.AreEqual(expected.Trim(), html.Trim(), testName); Assert.Fail(); } catch (JadeCompilerException e) { Trace.WriteLine(e); } }
//throws Exception public JadeLexerTest() { FileTemplateLoader loader1 = new FileTemplateLoader(TestFileHelper.getLexerResourcePath(""), "UTF-8"); lexer1 = new JadeLexer("test_file1.jade", loader1); FileTemplateLoader loader2 = new FileTemplateLoader(TestFileHelper.getLexerResourcePath(""), "UTF-8"); lexer2 = new JadeLexer("empty_file.jade", loader2); }
protected JadeLexer initLexer(String fileName) { FileTemplateLoader loader; try { loader = new FileTemplateLoader(TestFileHelper.getLexerResourcePath(""), "UTF-8"); return new JadeLexer(fileName, loader); } catch (Exception e) { Trace.WriteLine(e); return null; } }
protected void loadInParser(String fileName) { try { FileTemplateLoader loader = new FileTemplateLoader( TestFileHelper.getParserResourcePath(""), "UTF-8"); parser = new JadeParser(fileName, loader); } catch (IOException e) { Trace.WriteLine(e); Assert.Fail("template " + fileName + " was not found"); } root = parser.parse(); }