summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McElwain <semcelwa@gmail.com>2020-10-29 20:04:20 -0400
committerGeorg Brandl <georg@python.org>2020-10-30 06:35:16 +0100
commitd953c84f54ae8a73a36ffe40fc22e325f99bd15a (patch)
treee7c1dcc229918ccb07fc37777454037acef16dbe
parent71278be76e49cf25e063aa59527a1120bbf77488 (diff)
downloadpygments-git-d953c84f54ae8a73a36ffe40fc22e325f99bd15a.tar.gz
added test to track djangojavascript lexer fix
-rw-r--r--tests/test_djangojavascript_lexer.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_djangojavascript_lexer.py b/tests/test_djangojavascript_lexer.py
new file mode 100644
index 00000000..d4a5f91b
--- /dev/null
+++ b/tests/test_djangojavascript_lexer.py
@@ -0,0 +1,37 @@
+import pytest
+
+from pygments.lexers.templates import JavascriptDjangoLexer
+from pygments.token import Comment
+
+
+@pytest.fixture(scope="module")
+def lexer():
+ yield JavascriptDjangoLexer()
+
+
+def test_do_not_mistake_JSDoc_for_django_comment(lexer):
+ text = """/**
+ * @param {*} cool
+ */
+ func = function(cool) {
+ };
+
+ /**
+ * @param {*} stuff
+ */
+ fun = function(stuff) {
+ };"""
+ tokens = list(lexer.get_tokens(text))
+ assert (
+ (
+ Comment,
+ """{*} cool
+ */
+ func = function(cool) {
+ };
+
+ /**
+ * @param {*}""",
+ )
+ not in tokens
+ )