emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phps-mode ec69d07 193/405: Added a failing class declar


From: Stefan Monnier
Subject: [elpa] externals/phps-mode ec69d07 193/405: Added a failing class declaration indentation case
Date: Sat, 13 Jul 2019 10:00:11 -0400 (EDT)

branch: externals/phps-mode
commit ec69d072888638b8c00e466c081d6be0f8ecf03c
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Added a failing class declaration indentation case
---
 phps-mode-functions.el      |  4 +++-
 phps-mode-test-functions.el | 12 ++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 77cd287..3434e9c 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -142,12 +142,14 @@
                         (progn
                           (setq in-class-declaration nil)
                           (setq in-class-declaration-level 0)
-                          
+
+                          ;; TODO Should only do this if class-declaration was 
not started on this line
                           (setq column-level (1- column-level))
                           (setq nesting-start (1- nesting-start))
                           (pop nesting-stack)
 
                           (when first-token-on-line
+
                             (setq after-class-declaration t)
                             (setq first-token-is-nesting-increase nil)
                             (setq first-token-is-nesting-decrease t))
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 346e30e..dfc3668 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -179,12 +179,24 @@
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0)) (6 (2 
0)) (7 (2 0)) (8 (3 0)) (9 (2 0)) (10 (1 0)) (11 (0 0))) 
(phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
   (phps-mode-test-with-buffer
+   "<?php\nnamespace myNamespace\n{\n    class myClass {\n        public 
function myFunction()\n        {\n            echo 'my statement';\n        }\n 
   }\n}\n"
+   "Regular PHP with namespaces, classes and functions"
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (2 0)) (6 (2 
0)) (7 (3 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) 
(phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+
+  (phps-mode-test-with-buffer
    "<?php\nclass MyClass extends MyAbstract implements\n    myInterface,\n    
myInterface2\n{\n}\n"
    "Class multi-line implements"
    ;; (message "Tokens: %s" phps-mode-lexer-tokens)
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
   (phps-mode-test-with-buffer
+   "<?php\nclass MyClass\n    extends MyAbstract\n    implements myInterface, 
myInterface2\n{\n}\n"
+   "Class multi-line extends and implements"
+   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+
+
+  (phps-mode-test-with-buffer
    "<?php\n/**\n *\n */\nnamespace Aomebo\n{\n    /**\n     *\n     */\n    
class Base\n    {\n    }\n}\n"
    "Namespace and class with doc-comments"
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1)) (5 (0 0)) (6 (0 
0)) (7 (1 0)) (8 (1 1)) (9 (1 1)) (10 (1 0)) (11 (1 0)) (12 (1 0)) (13 (0 0))) 
(phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]