Skip to content

Commit c861fca

Browse files
committed
Add test for lang/errorcontrol.php
1 parent 8a43710 commit c861fca

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

php-mode-test.el

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,4 +984,8 @@ Meant for `php-mode-test-issue-503'."
984984
"Test highlighting arrow funcsion (short closure syntax) added in PHP 7.4."
985985
(with-php-mode-test ("7.4/arrow-function.php" :faces t)))
986986

987+
(ert-deftest php-mode-test-lang ()
988+
"Test highlighting for language constructs."
989+
(with-php-mode-test ("lang/errorcontrol.php" :faces t)))
990+
987991
;;; php-mode-test.el ends here

tests/lang/errorcontrol.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
new stdClass;
4+
@new stdClass;
5+
echo @a.@b;
6+
echo @a;
7+
echo @$a;
8+
9+
@fopen('php://memory', 'rw');

tests/lang/errorcontrol.php.faces

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
;; -*- mode: emacs-lisp -*-
2+
(("<?php" . php-php-tag)
3+
("\n\n")
4+
("new" . php-keyword)
5+
(" ")
6+
("stdClass" . font-lock-type-face)
7+
(";\n")
8+
("@new" . php-keyword)
9+
(" ")
10+
("stdClass" . font-lock-type-face)
11+
(";\n")
12+
("echo" . php-keyword)
13+
(" ")
14+
("@" . php-errorcontrol-op)
15+
("a.")
16+
("@" . php-errorcontrol-op)
17+
("b;\n")
18+
("echo" . php-keyword)
19+
(" ")
20+
("@" . php-errorcontrol-op)
21+
("a;\n")
22+
("echo" . php-keyword)
23+
(" ")
24+
("@" . php-errorcontrol-op)
25+
("$" . php-variable-sigil)
26+
("a" . php-variable-name)
27+
(";\n\n")
28+
("@" . php-errorcontrol-op)
29+
("fopen(")
30+
("'php://memory'" . php-string)
31+
(", ")
32+
("'rw'" . php-string)
33+
(");\n"))

0 commit comments

Comments
 (0)