/** * Returns a new instance of the <code>TokenMaker</code> to test. * * @return The <code>TokenMaker</code> to test. */ private TokenMaker createTokenMaker() { return new CTokenMaker(); }
@Test public void testGetCurlyBracesDenoteCodeBlocks() { // Language that does use curly braces String syntaxStyle = SyntaxConstants.SYNTAX_STYLE_C; doc = new RSyntaxDocument(syntaxStyle); TokenMaker tokenMaker = new CTokenMaker(); Assert.assertEquals(tokenMaker.getCurlyBracesDenoteCodeBlocks(0), doc.getCurlyBracesDenoteCodeBlocks(0)); // Language that does not use curly braces syntaxStyle = SyntaxConstants.SYNTAX_STYLE_XML; doc.setSyntaxStyle(syntaxStyle); tokenMaker = new XMLTokenMaker(); Assert.assertEquals(tokenMaker.getCurlyBracesDenoteCodeBlocks(0), doc.getCurlyBracesDenoteCodeBlocks(0)); // Language in which some sub-languages do, some don't syntaxStyle = SyntaxConstants.SYNTAX_STYLE_HTML; doc.setSyntaxStyle(syntaxStyle); tokenMaker = new HTMLTokenMaker(); Assert.assertEquals(tokenMaker.getCurlyBracesDenoteCodeBlocks(0), doc.getCurlyBracesDenoteCodeBlocks(0)); Assert.assertEquals(tokenMaker.getCurlyBracesDenoteCodeBlocks(1), doc.getCurlyBracesDenoteCodeBlocks(1)); Assert.assertEquals(tokenMaker.getCurlyBracesDenoteCodeBlocks(2), doc.getCurlyBracesDenoteCodeBlocks(2)); // Sanity Assert.assertFalse(tokenMaker.getCurlyBracesDenoteCodeBlocks(0)); Assert.assertTrue(tokenMaker.getCurlyBracesDenoteCodeBlocks(1)); Assert.assertTrue(tokenMaker.getCurlyBracesDenoteCodeBlocks(2)); }