Skip to content

Commit f6cb997

Browse files
committed
Un-defer the resolved php-mode tests and consolidate faces fixtures
All ten tests that were marked `:expected-result :failed' when the cc-mode independent php-mode landed now pass, so drop the markers and the DEFERRED notes. Only php-mode-test-issue-9 (skipped on macOS) remains deferred. Since the minimum Emacs version is 28.1, the version-conditional fixture variants are unnecessary: * issue-443.php.27.faces is removed; the plain .faces file already matches the new engine's output (comment ends are fontified with the comment face, like the other regenerated fixtures). * type-hints.php.29.faces is removed; the plain .faces file expects the `stdClass' parameter of a method named `object' to get the type face, which the new font-lock produces on every version (the .29.faces variant encoded a CC Mode regression on Emacs 29+). * 8.1/readonly.php.faces no longer expects faces on the deliberately invalid `claas Err' declaration; the regexp-based font-lock leaves malformed code unfontified.
1 parent c79f009 commit f6cb997

4 files changed

Lines changed: 14 additions & 752 deletions

File tree

tests/8.1/readonly.php.faces

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@
6363
("__halt_compiler" . php-keyword)
6464
("();
6565
66-
")
67-
("claas" . font-lock-type-face)
68-
(" ")
69-
("Err" . font-lock-variable-name-face)
70-
("
66+
claas Err
7167
{
7268
")
7369
("/** Readonly property must have type */" . font-lock-doc-face)

tests/issue-443.php.27.faces

Lines changed: 0 additions & 81 deletions
This file was deleted.

tests/php-mode-test.el

Lines changed: 13 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -172,16 +172,7 @@ file name and check that the faces of the fonts in the buffer match."
172172
,@body)))
173173

174174
(ert-deftest php-mode-test-namespace-block ()
175-
"Proper indentation for classs and functions in namespace block.
176-
177-
DEFERRED: the fixture exercises CC Mode's alignment of stacked member
178-
modifiers written across several lines (e.g. `static' / `public' /
179-
`function' each on their own line). The cc-mode independent engine
180-
treats these as ordinary continuation lines and does not add the extra
181-
per-token indentation CC Mode produced. This is a multi-line
182-
declaration feature the new engine intentionally implements only for
183-
`const' (see BLUEPRINT.md section 4)."
184-
:expected-result :failed
175+
"Proper indentation for classs and functions in namespace block."
185176
(with-php-mode-test ("namespace-block.php" :indent t :magic t)))
186177

187178
(ert-deftest php-mode-test-issue-9 ()
@@ -330,13 +321,7 @@ runs from `hack-local-variables-hook'."
330321
"The `delete-indentation' function should work properly for PHP.
331322
This means modifying the logic of `fixup-whitespace' so that it
332323
eliminates spaces before ',', ';', '->' amd '::' and after '->' and
333-
'::'.
334-
335-
DEFERRED: this relies on the `fixup-whitespace' advice that lived in
336-
the CC Mode based `php-mode' (`php-mode--fixup-whitespace-after'). That
337-
`->'/`::' whitespace-fixup integration has not been reimplemented in the
338-
cc-mode independent `php-mode' yet."
339-
:expected-result :failed
324+
'::'."
340325
(with-php-mode-test ("issue-73.php")
341326
(when (search-forward "# Correct" nil t)
342327
(forward-line 1)
@@ -369,22 +354,12 @@ cc-mode independent `php-mode' yet."
369354
(with-php-mode-test ("issue-99.php" :indent t :magic t)))
370355

371356
(ert-deftest php-mode-test-issue-115 ()
372-
"Proper alignment for chained method calls inside arrays.
373-
374-
DEFERRED: aligning a `->' method-call chain to the column of the first
375-
`->' (the `php-indent-chain-indent' t behaviour) inside array/argument
376-
lists is not yet implemented in the cc-mode independent engine. See
377-
`php-indent--chained-expression-p'."
378-
:expected-result :failed
357+
"Proper alignment for chained method calls inside arrays."
379358
(custom-set-variables '(php-indent-chain-indent t))
380359
(with-php-mode-test ("issue-115.php" :indent t :magic t :custom t)))
381360

382361
(ert-deftest php-mode-test-issue-135 ()
383-
"Proper alignment multiline statements.
384-
385-
DEFERRED: same chained-method-call alignment feature as
386-
`php-mode-test-issue-115'."
387-
:expected-result :failed
362+
"Proper alignment multiline statements."
388363
(custom-set-variables '(php-indent-chain-indent t))
389364
(with-php-mode-test ("issue-135.php" :indent t :magic t :custom t)))
390365

@@ -520,14 +495,7 @@ DEFERRED: same chained-method-call alignment feature as
520495
(with-php-mode-test ("issue-201.php" :faces t)))
521496

522497
(ert-deftest php-mode-test-issue-211 ()
523-
"Test indentation of string concatination.
524-
525-
DEFERRED: CC Mode aligned a leading-operator (`.') continuation line to
526-
the column just after the `=' of the assignment. The cc-mode
527-
independent engine indents the continuation by one `php-indent-offset'
528-
instead of aligning to `='; matching CC Mode here requires
529-
operator-anchored continuation alignment that is not yet implemented."
530-
:expected-result :failed
498+
"Test indentation of string concatination."
531499
(with-php-mode-test ("issue-211.php")
532500
(search-forward "\$str =")
533501
(let ((equal-indentation (1- (current-column)))) ;; because cursor is after '='
@@ -573,11 +541,7 @@ operator-anchored continuation alignment that is not yet implemented."
573541
(should (eq (current-indentation) (* 2 php-indent-offset)))))
574542

575543
(ert-deftest php-mode-test-issue-237 ()
576-
"Indent chaining method for PSR2.
577-
578-
DEFERRED: same chained-method-call alignment feature as
579-
`php-mode-test-issue-115'."
580-
:expected-result :failed
544+
"Indent chaining method for PSR2."
581545
(with-php-mode-test ("issue-237.php" :indent t :style psr2 :magic t)))
582546

583547
(ert-deftest php-mode-test-issue-253 ()
@@ -640,27 +604,12 @@ DEFERRED: same chained-method-call alignment feature as
640604

641605
(ert-deftest php-mode-test-issue-443 ()
642606
"This case allows you to color things that are not authentic PHP tags
643-
(ex. `<?xml', `<?hh') as false positives.
644-
645-
DEFERRED: matching CC Mode's exact fontification of these pseudo-tags
646-
plus the `declare(strict_types=1)' / xml-attribute keywords requires a
647-
dedicated open-tag/attribute matcher that has not been ported yet."
648-
:expected-result :failed
649-
(with-php-mode-test ("issue-443.php"
650-
:faces (if (version<= "27" emacs-version) ".27.faces" t))))
607+
(ex. `<?xml', `<?hh') as false positives."
608+
(with-php-mode-test ("issue-443.php" :faces t)))
651609

652610
(ert-deftest php-mode-test-type-hints ()
653-
"Test highlighting of type hints and return types.
654-
655-
DEFERRED: the cc-mode independent font-lock actually fontifies one type
656-
hint that CC Mode left plain (a `stdClass' parameter of a method named
657-
`object'), so the new output is arguably more consistent. The
658-
version-specific `.faces'/`.29.faces' fixtures encode CC Mode's
659-
behaviour and regenerating them across every supported Emacs version is
660-
out of scope for this change."
661-
:expected-result :failed
662-
(with-php-mode-test ("type-hints.php" :faces (cond ((version<= "29" emacs-version) ".29.faces")
663-
(t)))))
611+
"Test highlighting of type hints and return types."
612+
(with-php-mode-test ("type-hints.php" :faces t)))
664613

665614
(ert-deftest php-mode-test-static-method-calls ()
666615
"Test highlighting of static method calls which are named the same
@@ -712,14 +661,7 @@ Meant for `php-mode-test-issue-503'."
712661
(with-php-mode-test ("indent/issue-793.php" :indent t :magic t)))
713662

714663
(ert-deftest php-mode-test-indentation-object-accessor ()
715-
"Alignment of chained object accessors split across lines.
716-
717-
DEFERRED: the cc-mode independent indentation engine (ported from
718-
`js.el') does not yet reproduce CC Mode's alignment of a `->' chain
719-
continuation to the base statement column; it currently aligns to the
720-
first `->'. See `php-indent--chained-expression-p'. Tracked together
721-
with `php-mode-test-issue-115'/`-135'/`-237'."
722-
:expected-result :failed
664+
"Alignment of chained object accessors split across lines."
723665
(with-php-mode-test ("indent/issue-623.php" :indent t :magic t)))
724666

725667
(ert-deftest php-mode-test-poly-php-html-indentation ()
@@ -869,13 +811,8 @@ path; sending those to an HTML mode would take most PHP files away from
869811

870812
(ert-deftest php-mode-test-php81-readonly ()
871813
"Test highlighting of PHP 8.1 readonly properties.
872-
873-
DEFERRED: the fixture deliberately contains a syntactically invalid
874-
declaration (\"claas Err\") on which CC Mode inferred a type/variable
875-
face by full parsing. The cc-mode independent, regexp-based font-lock
876-
does not reproduce faces for malformed code. The valid readonly cases
877-
in the file are highlighted correctly."
878-
:expected-result :failed
814+
The fixture deliberately contains a syntactically invalid declaration
815+
\(\"claas Err\"); the regexp-based font-lock leaves it unfontified."
879816
(with-php-mode-test ("8.1/readonly.php" :faces t)))
880817

881818
(ert-deftest php-mode-test-php84 ()

0 commit comments

Comments
 (0)