From 58e1c8b382fc5794bec54ea23f63d3074b95fa70 Mon Sep 17 00:00:00 2001 From: tijsmallaerts Date: Sat, 15 Jun 2019 08:08:37 +0200 Subject: [PATCH] Fix comments test for emacs 27 --- php-mode-test.el | 6 +- tests/comments.php.27.faces | 166 ++++++++++++++++++++++++++++++++++++ 2 files changed, 169 insertions(+), 3 deletions(-) create mode 100644 tests/comments.php.27.faces diff --git a/php-mode-test.el b/php-mode-test.el index 1a9177d6..b84535da 100644 --- a/php-mode-test.el +++ b/php-mode-test.el @@ -669,9 +669,9 @@ Meant for `php-mode-test-issue-503'." (ert-deftest php-mode-test-lang () "Test highlighting for language constructs." (with-php-mode-test ("comments.php" - :faces (if (eq emacs-major-version 24) - ".24.faces" - t))) + :faces (cond ((eq emacs-major-version 24) ".24.faces") + ((version<= "27" emacs-version) ".27.faces") + (t t)))) (with-php-mode-test ("doc-comment-return-type.php" :faces t)) (with-php-mode-test ("lang/types/cast.php" :faces t)) (with-php-mode-test ("lang/types/function.php" :faces t)) diff --git a/tests/comments.php.27.faces b/tests/comments.php.27.faces new file mode 100644 index 00000000..3867ad64 --- /dev/null +++ b/tests/comments.php.27.faces @@ -0,0 +1,166 @@ +;; -*- mode: emacs-lisp -*- +(("\n * " . font-lock-doc-face) + ("@link" php-doc-annotation-tag font-lock-doc-face) + (" " . font-lock-doc-face) + ("https://github.com/emacs-php/php-mode" link font-lock-doc-face) + ("\n * " . font-lock-doc-face) + ("@package" php-doc-annotation-tag font-lock-doc-face) + (" " . font-lock-doc-face) + ("Emacs\\PHPMode" php-string font-lock-doc-face) + ("\n */" . font-lock-doc-face) + ("\n\n") + ("// " . font-lock-comment-delimiter-face) + ("one-line comment\n" . font-lock-comment-face) + ("// " . font-lock-comment-delimiter-face) + ("@annotation This is NOT annotation. 1\n" . font-lock-comment-face) + ("\n") + ("/*" . font-lock-comment-delimiter-face) + ("------------------------------------------------\n Multi-line comment\n\n * @annotation This is NOT annotation. 2\n -------------------------------------------------" . font-lock-comment-face) + ("*/" . font-lock-comment-delimiter-face) + ("\n\n") + ("// " . font-lock-comment-delimiter-face) + ("/**\n" . font-lock-comment-face) + ("// " . font-lock-comment-delimiter-face) + ("* Comment outed class implementation\n" . font-lock-comment-face) + ("// " . font-lock-comment-delimiter-face) + ("*\n" . font-lock-comment-face) + ("// " . font-lock-comment-delimiter-face) + ("* @annotation This is NOT annotation. 3\n" . font-lock-comment-face) + ("// " . font-lock-comment-delimiter-face) + ("*/\n" . font-lock-comment-face) + ("// " . font-lock-comment-delimiter-face) + ("class CommentOuted\n" . font-lock-comment-face) + ("// " . font-lock-comment-delimiter-face) + ("{\n" . font-lock-comment-face) + ("// " . font-lock-comment-delimiter-face) + ("}\n" . font-lock-comment-face) + ("\n") + ("/**\n * Class level doc-comment\n *\n * Description " . font-lock-doc-face) + ("{@internal " php-doc-annotation-tag font-lock-doc-face) + ("Description" php-string php-doc-annotation-tag font-lock-doc-face) + ("}" php-doc-annotation-tag font-lock-doc-face) + (" inline tag.\n *\n * " . font-lock-doc-face) + ("@property-read" php-doc-annotation-tag font-lock-doc-face) + (" " . font-lock-doc-face) + ("string" font-lock-type-face php-string font-lock-doc-face) + ("[]" php-string font-lock-doc-face) + (" " . font-lock-doc-face) + ("$" php-doc-variable-sigil font-lock-doc-face) + ("name" php-variable-name font-lock-doc-face) + ("\n * " . font-lock-doc-face) + ("@ORM\\Table" php-doc-annotation-tag font-lock-doc-face) + ("(name=\"majormodes\")\n * " . font-lock-doc-face) + ("@ORM\\Entity" php-doc-annotation-tag font-lock-doc-face) + ("(repositoryClass=\"Emacs\\Repository\\MajorModeRepository\")\n */" . font-lock-doc-face) + ("\n") + ("final" . php-keyword) + (" ") + ("class" . php-keyword) + (" ") + ("SampleClass" . font-lock-type-face) + ("\n{\n ") + ("/** Const doc-comment */" . font-lock-doc-face) + ("\n ") + ("const" . php-keyword) + (" ") + ("SAMPLE" . font-lock-type-face) + (" = ") + ("'SAMPLE'" . php-string) + (";\n ") + ("/** " . font-lock-doc-face) + ("@var" php-doc-annotation-tag font-lock-doc-face) + (" " . font-lock-doc-face) + ("string" font-lock-type-face php-string font-lock-doc-face) + (" sample property doc-comment */" . font-lock-doc-face) + ("\n ") + ("private" . php-keyword) + (" ") + ("$" . php-variable-sigil) + ("name" . php-variable-name) + (";\n\n ") + ("/**\n * " . font-lock-doc-face) + ("@param" php-doc-annotation-tag font-lock-doc-face) + (" " . font-lock-doc-face) + ("string" font-lock-type-face php-string font-lock-doc-face) + (" " . font-lock-doc-face) + ("$" php-doc-variable-sigil font-lock-doc-face) + ("name" php-variable-name font-lock-doc-face) + ("\n */" . font-lock-doc-face) + ("\n ") + ("public" . php-keyword) + (" ") + ("function" . php-keyword) + (" ") + ("__construct" . php-function-name) + ("(") + ("$" . php-variable-sigil) + ("name" . php-variable-name) + (")\n {\n ") + ("$" . php-$this-sigil) + ("this" . php-$this) + ("->" . php-object-op) + ("name" . php-property-name) + (" = ") + ("$" . php-variable-sigil) + ("name" . php-variable-name) + ("; ") + ("// " . font-lock-comment-delimiter-face) + ("comment in after code\n" . font-lock-comment-face) + ("\n ") + ("/** " . font-lock-doc-face) + ("@var" php-doc-annotation-tag font-lock-doc-face) + (" " . font-lock-doc-face) + ("string" font-lock-type-face php-string font-lock-doc-face) + ("|" php-string font-lock-doc-face) + ("bool" font-lock-type-face php-string font-lock-doc-face) + ("|" php-string font-lock-doc-face) + ("array" font-lock-type-face php-string font-lock-doc-face) + ("[]|ArrayObject" php-string font-lock-doc-face) + (" */" . font-lock-doc-face) + ("\n ") + ("$" . php-variable-sigil) + ("foo" . php-variable-name) + (" = hoge();\n\n ") + ("// " . font-lock-comment-delimiter-face) + ("one-line comment\n" . font-lock-comment-face) + (" ") + ("// " . font-lock-comment-delimiter-face) + ("@annotation This is NOT annotation. 4\n" . font-lock-comment-face) + ("\n ") + ("/** " . font-lock-doc-face) + ("@var" php-doc-annotation-tag font-lock-doc-face) + (" " . font-lock-doc-face) + ("int" font-lock-type-face php-string font-lock-doc-face) + (" internal linter variable */" . font-lock-doc-face) + ("\n ") + ("$" . php-variable-sigil) + ("offset" . php-variable-name) + (" = 0;\n }\n\n ") + ("/**\n * Summary\n *\n * " . font-lock-doc-face) + ("@throws" php-doc-annotation-tag font-lock-doc-face) + (" " . font-lock-doc-face) + ("\\RuntimeException" php-string font-lock-doc-face) + ("\n */" . font-lock-doc-face) + ("\n ") + ("public" . php-keyword) + (" ") + ("function" . php-keyword) + (" ") + ("test" . php-function-name) + ("()\n {\n ") + ("throw" . php-keyword) + (" ") + ("new" . php-keyword) + (" ") + ("\\RuntimeException" . font-lock-type-face) + (";\n }\n}\n"))