Esempio n. 1
0
class ColdfusionHtmlLexerTest(unittest.TestCase):

    def setUp(self):
        self.lexer = ColdfusionHtmlLexer()

    def testBasicComment(self):
        fragment = u'<!--- cfcomment --->'
        expected = [
            (Token.Text, u''),
            (Token.Comment.Multiline, u'<!---'),
            (Token.Comment.Multiline, u' cfcomment '),
            (Token.Comment.Multiline, u'--->'),
            (Token.Text, u'\n'),
        ]
        self.assertEqual(expected, list(self.lexer.get_tokens(fragment)))

    def testNestedComment(self):
        fragment = u'<!--- nested <!--- cfcomment ---> --->'
        expected = [
            (Token.Text, u''),
            (Token.Comment.Multiline, u'<!---'),
            (Token.Comment.Multiline, u' nested '),
            (Token.Comment.Multiline, u'<!---'),
            (Token.Comment.Multiline, u' cfcomment '),
            (Token.Comment.Multiline, u'--->'),
            (Token.Comment.Multiline, u' '),
            (Token.Comment.Multiline, u'--->'),
            (Token.Text, u'\n'),
        ]
        self.assertEqual(expected, list(self.lexer.get_tokens(fragment)))
Esempio n. 2
0
class ColdfusionHtmlLexerTest(unittest.TestCase):
    def setUp(self):
        self.lexer = ColdfusionHtmlLexer()

    def testBasicComment(self):
        fragment = u'<!--- cfcomment --->'
        expected = [
            (Token.Text, u''),
            (Token.Comment.Multiline, u'<!---'),
            (Token.Comment.Multiline, u' cfcomment '),
            (Token.Comment.Multiline, u'--->'),
            (Token.Text, u'\n'),
        ]
        self.assertEqual(expected, list(self.lexer.get_tokens(fragment)))

    def testNestedComment(self):
        fragment = u'<!--- nested <!--- cfcomment ---> --->'
        expected = [
            (Token.Text, u''),
            (Token.Comment.Multiline, u'<!---'),
            (Token.Comment.Multiline, u' nested '),
            (Token.Comment.Multiline, u'<!---'),
            (Token.Comment.Multiline, u' cfcomment '),
            (Token.Comment.Multiline, u'--->'),
            (Token.Comment.Multiline, u' '),
            (Token.Comment.Multiline, u'--->'),
            (Token.Text, u'\n'),
        ]
        self.assertEqual(expected, list(self.lexer.get_tokens(fragment)))
Esempio n. 3
0
 def setUp(self):
     self.lexer = ColdfusionHtmlLexer()
Esempio n. 4
0
 def setUp(self):
     self.lexer = ColdfusionHtmlLexer()
Esempio n. 5
0
def lexer():
    yield ColdfusionHtmlLexer()