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

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

[elpa] externals/phps-mode 7e22fdb 323/405: Added failing incremental in


From: Stefan Monnier
Subject: [elpa] externals/phps-mode 7e22fdb 323/405: Added failing incremental indentation test
Date: Sat, 13 Jul 2019 10:00:41 -0400 (EDT)

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

    Added failing incremental indentation test
---
 phps-mode-functions.el        |  2 +-
 phps-mode-test-integration.el | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index d902626..d4e1bc0 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -53,7 +53,7 @@
 
 (defun phps-mode-functions-reset-buffer-changes-start ()
   "Reset buffer change start."
-  (message "Reset flag for buffer changes")
+  ;; (message "Reset flag for buffer changes")
   (setq phps-mode-functions-buffer-changes-start nil))
 
 (defun phps-mode-functions-process-current-buffer ()
diff --git a/phps-mode-test-integration.el b/phps-mode-test-integration.el
index a103f74..999679b 100644
--- a/phps-mode-test-integration.el
+++ b/phps-mode-test-integration.el
@@ -66,6 +66,9 @@
    ;; Run incremental lexer
    (phps-mode-lexer-run-incremental)
 
+   ;; TODO Should maybe change this to a more more simpler way
+   ;; like compare lexer tokens, indent and imenu with same contents in a new 
buffer
+
    ;; Tokens
    ;; (message "Tokens %s" (phps-mode-lexer-get-tokens))
    (should (equal (phps-mode-lexer-get-tokens) '((T_OPEN_TAG 1 . 7) 
(T_NAMESPACE 7 . 16) (T_STRING 17 . 28) ("{" 29 . 30) (T_CLASS 35 . 40) 
(T_STRING 41 . 48) ("{" 53 . 54) (T_PUBLIC 63 . 69) (T_FUNCTION 70 . 78) 
(T_STRING 79 . 89) ("(" 89 . 90) (")" 90 . 91) ("{" 100 . 101) (T_ECHO 114 . 
118) (T_CONSTANT_ENCAPSED_STRING 119 . 133) (";" 133 . 134) (";" 133 . 134) 
("}" 143 . 144) (T_PUBLIC 154 . 160) (T_FUNCTION 161 . 169) (T_STRING 170 . 
181) ("(" 181 . 182) (")" 182 . 183) ("{" 192 . 19 [...]
@@ -75,7 +78,33 @@
    (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 (2 0)) (11 (2 0)) (12 (2 0)) (13 (3 0)) 
(14 (2 0)) (15 (2 0)) (16 (1 0)) (17 (0 0))) (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent))))
 
    ;; Imenu
-   (should (equal (phps-mode-functions-get-imenu) '(("\\myNamespace" . 17) 
("\\myNamespace\\myClass" . 41) ("\\myNamespace\\myClass->myFunction()" . 79) 
("\\myNamespace\\myClass->myFunctionB()" . 170)))))
+   (should (equal (phps-mode-functions-get-imenu) '(("\\myNamespace" . 17) 
("\\myNamespace\\myClass" . 41) ("\\myNamespace\\myClass->myFunction()" . 79) 
("\\myNamespace\\myClass->myFunctionB()" . 170))))
+
+   ;; Remove first function
+   (goto-char 55)
+   (push-mark nil t t)
+   (goto-char 145)
+   (execute-kbd-macro (kbd "<backspace>"))
+
+   ;; Verify stored point of change
+   (should (equal (phps-mode-functions-get-buffer-changes-start) 55))
+
+   ;; Run incremental lexer
+   (phps-mode-lexer-run-incremental)
+
+   ;; Tokens
+   ;; (message "Tokens %s" (phps-mode-lexer-get-tokens))
+   (should (equal (phps-mode-lexer-get-tokens) '((T_OPEN_TAG 1 . 7) 
(T_NAMESPACE 7 . 16) (T_STRING 17 . 28) ("{" 29 . 30) (T_CLASS 35 . 40) 
(T_STRING 41 . 48) ("{" 53 . 54) ("{" 53 . 54) (T_PUBLIC 64 . 70) (T_FUNCTION 
71 . 79) (T_STRING 80 . 91) ("(" 91 . 92) (")" 92 . 93) ("{" 102 . 103) (T_ECHO 
116 . 120) (T_CONSTANT_ENCAPSED_STRING 121 . 142) (";" 142 . 143) ("}" 152 . 
153) ("}" 159 . 160) ("}" 161 . 162))))
+
+   ;; Imenu
+   (should (equal (phps-mode-functions-get-imenu) '(("\\myNamespace" . 17) 
("\\myNamespace\\myClass" . 41) ("\\myNamespace\\myClass->myFunctionB()" . 80) 
)))
+
+   ;; Indentation
+   (message "indent: %s" (phps-mode-test-hash-to-list 
(phps-mode-functions-get-lines-indent)))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (1 0)) (6 (2 
0)) (7 (2 0)) (8 (2 0)) (9 (3 0)) (10 (2 0)) (11 (2 0)) (12 (1 0)) (13 (0 0))) 
(phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent))))
+
+
+   )
 
 )
 



reply via email to

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