summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2014-05-12 13:33:48 -0700
committerTim Hatch <tim@timhatch.com>2014-05-12 13:33:48 -0700
commit16b39eea26af87813151b03992f2ed4738057eaa (patch)
treeb5651a83535cc46bbc3faf3b96fc497262305807 /tests
parentc6f9868a4aef43beec4f80c582dad9c69c34c231 (diff)
parente1f88dcdb9733044ab793866e25f1a5810c926fa (diff)
downloadpygments-16b39eea26af87813151b03992f2ed4738057eaa.tar.gz
Merged in jaingaurav2/pygments-main-978 (pull request #339)
ColdFusion: Add Support for nested comments
Diffstat (limited to 'tests')
-rw-r--r--tests/examplefiles/demo.cfm12
-rw-r--r--tests/test_cfm.py46
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/examplefiles/demo.cfm b/tests/examplefiles/demo.cfm
index d94a06a0..49690484 100644
--- a/tests/examplefiles/demo.cfm
+++ b/tests/examplefiles/demo.cfm
@@ -1,4 +1,11 @@
<!--- cfcomment --->
+<!--- nested <!--- cfcomment ---> --->
+<!--- multi-line
+nested
+<!---
+cfcomment
+--->
+--->
<!-- html comment -->
<html>
<head>
@@ -17,6 +24,9 @@
#IsDate("foo")#<br />
#DaysInMonth(RightNow)#
</cfoutput>
+<cfset x="x">
+<cfset y="y">
+<cfset z="z">
<cfoutput group="x">
#x#
<cfoutput>#y#</cfoutput>
@@ -29,6 +39,8 @@
<cfset greeting = "Hello #person#">
<cfset greeting = "Hello" & " world!">
+<cfset a = 5>
+<cfset b = 10>
<cfset c = a^b>
<cfset c = a MOD b>
<cfset c = a / b>
diff --git a/tests/test_cfm.py b/tests/test_cfm.py
new file mode 100644
index 00000000..2ff25bd6
--- /dev/null
+++ b/tests/test_cfm.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+"""
+ Basic ColdfusionHtmlLexer Test
+ ~~~~~~~~~~~~~~~~~
+
+ :copyright: Copyright 2014 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+import unittest
+import os
+
+from pygments.token import Token
+from pygments.lexers import ColdfusionHtmlLexer
+
+
+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)))