Skip to content

Commit e377358

Browse files
authored
Merge pull request #544 from mallt/fix-php-comment-test-for-emacs-27
Fix comments test for emacs 27
2 parents c53e0c1 + 58e1c8b commit e377358

File tree

2 files changed

+169
-3
lines changed

2 files changed

+169
-3
lines changed

php-mode-test.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,9 @@ Meant for `php-mode-test-issue-503'."
669669
(ert-deftest php-mode-test-lang ()
670670
"Test highlighting for language constructs."
671671
(with-php-mode-test ("comments.php"
672-
:faces (if (eq emacs-major-version 24)
673-
".24.faces"
674-
t)))
672+
:faces (cond ((eq emacs-major-version 24) ".24.faces")
673+
((version<= "27" emacs-version) ".27.faces")
674+
(t t))))
675675
(with-php-mode-test ("doc-comment-return-type.php" :faces t))
676676
(with-php-mode-test ("lang/types/cast.php" :faces t))
677677
(with-php-mode-test ("lang/types/function.php" :faces t))

tests/comments.php.27.faces

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
;; -*- mode: emacs-lisp -*-
2+
(("<?php" . php-php-tag)
3+
("\n\n")
4+
("/**\n * File level doc-comment\n *\n * " . font-lock-doc-face)
5+
("@copyright" php-doc-annotation-tag font-lock-doc-face)
6+
(" 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad\n * " . font-lock-doc-face)
7+
("@copyright" php-doc-annotation-tag font-lock-doc-face)
8+
(" 2008 Aaron S. Hawley\n * " . font-lock-doc-face)
9+
("@copyright" php-doc-annotation-tag font-lock-doc-face)
10+
(" 2011, 2012, 2013, 2014, 2015, 2016 Eric James Michael Ritz\n * " . font-lock-doc-face)
11+
("@author" php-doc-annotation-tag font-lock-doc-face)
12+
(" USAMI Kenta <[email protected]>\n * " . font-lock-doc-face)
13+
("@link" php-doc-annotation-tag font-lock-doc-face)
14+
(" " . font-lock-doc-face)
15+
("https://github.com/emacs-php/php-mode" link font-lock-doc-face)
16+
("\n * " . font-lock-doc-face)
17+
("@package" php-doc-annotation-tag font-lock-doc-face)
18+
(" " . font-lock-doc-face)
19+
("Emacs\\PHPMode" php-string font-lock-doc-face)
20+
("\n */" . font-lock-doc-face)
21+
("\n\n")
22+
("// " . font-lock-comment-delimiter-face)
23+
("one-line comment\n" . font-lock-comment-face)
24+
("// " . font-lock-comment-delimiter-face)
25+
("@annotation This is NOT annotation. 1\n" . font-lock-comment-face)
26+
("\n")
27+
("/*" . font-lock-comment-delimiter-face)
28+
("------------------------------------------------\n Multi-line comment\n\n * @annotation This is NOT annotation. 2\n -------------------------------------------------" . font-lock-comment-face)
29+
("*/" . font-lock-comment-delimiter-face)
30+
("\n\n")
31+
("// " . font-lock-comment-delimiter-face)
32+
("/**\n" . font-lock-comment-face)
33+
("// " . font-lock-comment-delimiter-face)
34+
("* Comment outed class implementation\n" . font-lock-comment-face)
35+
("// " . font-lock-comment-delimiter-face)
36+
("*\n" . font-lock-comment-face)
37+
("// " . font-lock-comment-delimiter-face)
38+
("* @annotation This is NOT annotation. 3\n" . font-lock-comment-face)
39+
("// " . font-lock-comment-delimiter-face)
40+
("*/\n" . font-lock-comment-face)
41+
("// " . font-lock-comment-delimiter-face)
42+
("class CommentOuted\n" . font-lock-comment-face)
43+
("// " . font-lock-comment-delimiter-face)
44+
("{\n" . font-lock-comment-face)
45+
("// " . font-lock-comment-delimiter-face)
46+
("}\n" . font-lock-comment-face)
47+
("\n")
48+
("/**\n * Class level doc-comment\n *\n * Description " . font-lock-doc-face)
49+
("{@internal " php-doc-annotation-tag font-lock-doc-face)
50+
("Description" php-string php-doc-annotation-tag font-lock-doc-face)
51+
("}" php-doc-annotation-tag font-lock-doc-face)
52+
(" inline tag.\n *\n * " . font-lock-doc-face)
53+
("@property-read" php-doc-annotation-tag font-lock-doc-face)
54+
(" " . font-lock-doc-face)
55+
("string" font-lock-type-face php-string font-lock-doc-face)
56+
("[]" php-string font-lock-doc-face)
57+
(" " . font-lock-doc-face)
58+
("$" php-doc-variable-sigil font-lock-doc-face)
59+
("name" php-variable-name font-lock-doc-face)
60+
("\n * " . font-lock-doc-face)
61+
("@ORM\\Table" php-doc-annotation-tag font-lock-doc-face)
62+
("(name=\"majormodes\")\n * " . font-lock-doc-face)
63+
("@ORM\\Entity" php-doc-annotation-tag font-lock-doc-face)
64+
("(repositoryClass=\"Emacs\\Repository\\MajorModeRepository\")\n */" . font-lock-doc-face)
65+
("\n")
66+
("final" . php-keyword)
67+
(" ")
68+
("class" . php-keyword)
69+
(" ")
70+
("SampleClass" . font-lock-type-face)
71+
("\n{\n ")
72+
("/** Const doc-comment */" . font-lock-doc-face)
73+
("\n ")
74+
("const" . php-keyword)
75+
(" ")
76+
("SAMPLE" . font-lock-type-face)
77+
(" = ")
78+
("'SAMPLE'" . php-string)
79+
(";\n ")
80+
("/** " . font-lock-doc-face)
81+
("@var" php-doc-annotation-tag font-lock-doc-face)
82+
(" " . font-lock-doc-face)
83+
("string" font-lock-type-face php-string font-lock-doc-face)
84+
(" sample property doc-comment */" . font-lock-doc-face)
85+
("\n ")
86+
("private" . php-keyword)
87+
(" ")
88+
("$" . php-variable-sigil)
89+
("name" . php-variable-name)
90+
(";\n\n ")
91+
("/**\n * " . font-lock-doc-face)
92+
("@param" php-doc-annotation-tag font-lock-doc-face)
93+
(" " . font-lock-doc-face)
94+
("string" font-lock-type-face php-string font-lock-doc-face)
95+
(" " . font-lock-doc-face)
96+
("$" php-doc-variable-sigil font-lock-doc-face)
97+
("name" php-variable-name font-lock-doc-face)
98+
("\n */" . font-lock-doc-face)
99+
("\n ")
100+
("public" . php-keyword)
101+
(" ")
102+
("function" . php-keyword)
103+
(" ")
104+
("__construct" . php-function-name)
105+
("(")
106+
("$" . php-variable-sigil)
107+
("name" . php-variable-name)
108+
(")\n {\n ")
109+
("$" . php-$this-sigil)
110+
("this" . php-$this)
111+
("->" . php-object-op)
112+
("name" . php-property-name)
113+
(" = ")
114+
("$" . php-variable-sigil)
115+
("name" . php-variable-name)
116+
("; ")
117+
("// " . font-lock-comment-delimiter-face)
118+
("comment in after code\n" . font-lock-comment-face)
119+
("\n ")
120+
("/** " . font-lock-doc-face)
121+
("@var" php-doc-annotation-tag font-lock-doc-face)
122+
(" " . font-lock-doc-face)
123+
("string" font-lock-type-face php-string font-lock-doc-face)
124+
("|" php-string font-lock-doc-face)
125+
("bool" font-lock-type-face php-string font-lock-doc-face)
126+
("|" php-string font-lock-doc-face)
127+
("array" font-lock-type-face php-string font-lock-doc-face)
128+
("[]|ArrayObject" php-string font-lock-doc-face)
129+
(" */" . font-lock-doc-face)
130+
("\n ")
131+
("$" . php-variable-sigil)
132+
("foo" . php-variable-name)
133+
(" = hoge();\n\n ")
134+
("// " . font-lock-comment-delimiter-face)
135+
("one-line comment\n" . font-lock-comment-face)
136+
(" ")
137+
("// " . font-lock-comment-delimiter-face)
138+
("@annotation This is NOT annotation. 4\n" . font-lock-comment-face)
139+
("\n ")
140+
("/** " . font-lock-doc-face)
141+
("@var" php-doc-annotation-tag font-lock-doc-face)
142+
(" " . font-lock-doc-face)
143+
("int" font-lock-type-face php-string font-lock-doc-face)
144+
(" internal linter variable */" . font-lock-doc-face)
145+
("\n ")
146+
("$" . php-variable-sigil)
147+
("offset" . php-variable-name)
148+
(" = 0;\n }\n\n ")
149+
("/**\n * Summary\n *\n * " . font-lock-doc-face)
150+
("@throws" php-doc-annotation-tag font-lock-doc-face)
151+
(" " . font-lock-doc-face)
152+
("\\RuntimeException" php-string font-lock-doc-face)
153+
("\n */" . font-lock-doc-face)
154+
("\n ")
155+
("public" . php-keyword)
156+
(" ")
157+
("function" . php-keyword)
158+
(" ")
159+
("test" . php-function-name)
160+
("()\n {\n ")
161+
("throw" . php-keyword)
162+
(" ")
163+
("new" . php-keyword)
164+
(" ")
165+
("\\RuntimeException" . font-lock-type-face)
166+
(";\n }\n}\n"))

0 commit comments

Comments
 (0)