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

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

[elpa] externals/phps-mode 654ef5f 377/405: Added another state test for


From: Stefan Monnier
Subject: [elpa] externals/phps-mode 654ef5f 377/405: Added another state test for newline
Date: Sat, 13 Jul 2019 10:00:54 -0400 (EDT)

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

    Added another state test for newline
---
 phps-mode-test-functions.el | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index cdcdb49..1a72394 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -893,7 +893,6 @@
   )
 
 ;; TODO Add functionality for (delete-backward-char) as well
-;; TODO Test states as well
 (defun phps-mode-test-functions-whitespace-modifications ()
   "Test white-space modifications functions."
 
@@ -926,14 +925,28 @@
   (phps-mode-test-with-buffer
    "<?php\nif (true):\n    $var = 'abc';\n    $var2 = '123';\nendif;\n"
    "Add newline inside if body after two assignments and inspect moved tokens 
and states"
+
+   ;; Initial state
    ;; (message "Tokens %s" (phps-mode-lexer-get-tokens))
+   ;; (message "States: %s" (phps-mode-lexer-get-states))
    (should (equal (phps-mode-lexer-get-tokens)
                   '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_STRING 11 
. 15) (")" 15 . 16) (":" 16 . 17) (T_VARIABLE 22 . 26) ("=" 27 . 28) 
(T_CONSTANT_ENCAPSED_STRING 29 . 34) (";" 34 . 35) (T_VARIABLE 40 . 45) ("=" 46 
. 47) (T_CONSTANT_ENCAPSED_STRING 48 . 53) (";" 53 . 54) (T_ENDIF 55 . 60) (";" 
60 . 61))))
+   (should (equal (phps-mode-lexer-get-states)
+                  '((60 61 1 (1 1 1 1 1)) (55 60 1 (1 1 1 1 1)) (53 54 1 (1 1 
1 1 1)) (48 53 1 (1 1 1 1 1)) (46 47 1 (1 1 1 1 1)) (40 45 1 (1 1 1 1 1)) (34 
35 1 (1 1 1 1 1)) (29 34 1 (1 1 1 1 1)) (27 28 1 (1 1 1 1 1)) (22 26 1 (1 1 1 1 
1)) (16 17 1 (1 1 1 1 1)) (15 16 1 (1 1 1 1 1)) (11 15 1 (1 1 1 1 1)) (10 11 1 
(1 1 1 1 1)) (7 9 1 (1 1 1 1 1)) (1 7 1 (1 1 1 1 1)))))
+
+   ;; Change
    (goto-char 54)
    (newline-and-indent)
+
+   ;; Final state
    ;; (message "Tokens %s" (phps-mode-lexer-get-tokens))
+   ;; (message "States: %s" (phps-mode-lexer-get-states))
    (should (equal (phps-mode-lexer-get-tokens)
-                  '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_STRING 11 
. 15) (")" 15 . 16) (":" 16 . 17) (T_VARIABLE 22 . 26) ("=" 27 . 28) 
(T_CONSTANT_ENCAPSED_STRING 29 . 34) (";" 34 . 35) (T_VARIABLE 40 . 45) ("=" 46 
. 47) (T_CONSTANT_ENCAPSED_STRING 48 . 53) (";" 53 . 54) (T_ENDIF 60 . 65) (";" 
65 . 66)))))
+                  '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_STRING 11 
. 15) (")" 15 . 16) (":" 16 . 17) (T_VARIABLE 22 . 26) ("=" 27 . 28) 
(T_CONSTANT_ENCAPSED_STRING 29 . 34) (";" 34 . 35) (T_VARIABLE 40 . 45) ("=" 46 
. 47) (T_CONSTANT_ENCAPSED_STRING 48 . 53) (";" 53 . 54) (T_ENDIF 60 . 65) (";" 
65 . 66))))
+   (should (equal (phps-mode-lexer-get-states)
+                  '((65 66 1 (1 1 1 1 1)) (60 65 1 (1 1 1 1 1)) (53 54 1 (1 1 
1 1 1)) (48 53 1 (1 1 1 1 1)) (46 47 1 (1 1 1 1 1)) (40 45 1 (1 1 1 1 1)) (34 
35 1 (1 1 1 1 1)) (29 34 1 (1 1 1 1 1)) (27 28 1 (1 1 1 1 1)) (22 26 1 (1 1 1 1 
1)) (16 17 1 (1 1 1 1 1)) (15 16 1 (1 1 1 1 1)) (11 15 1 (1 1 1 1 1)) (10 11 1 
(1 1 1 1 1)) (7 9 1 (1 1 1 1 1)) (1 7 1 (1 1 1 1 1)))))
+
+   )
 
   )
 



reply via email to

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