[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 3d3003f 364/405: Started on test for newline-
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 3d3003f 364/405: Started on test for newline-and-indent before white-space |
Date: |
Sat, 13 Jul 2019 10:00:52 -0400 (EDT) |
branch: externals/phps-mode
commit 3d3003fa663e34b1a5c6ac2cc2ef285062664cc2
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Started on test for newline-and-indent before white-space
---
phps-mode-functions.el | 9 +++++----
phps-mode-test-functions.el | 15 +++++++++++++++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 41ad779..3385c41 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -96,7 +96,7 @@
"Process current buffer and generation indentation and Imenu in one
iteration. Complexity: O(n)."
(if (boundp 'phps-mode-lexer-tokens)
(save-excursion
- (message "Processing current buffer")
+ ;; (message "Processing current buffer")
(goto-char (point-min))
(when phps-mode-functions-verbose
(message "\nCalculation indentation for all lines in buffer:\n\n%s"
(buffer-substring-no-properties (point-min) (point-max))))
@@ -823,15 +823,16 @@
(if looking-at-whitespace
(progn
- (message "Looking at white-space")
+ ;; (message "Looking at white-space")
(setq new-pos (point))
(let ((diff (- new-pos old-pos)))
(when (> diff 0)
(phps-mode-lexer-move-tokens old-pos diff)
(phps-mode-lexer-move-states old-pos diff)
- (message "Old pos %s, new pos: %s, diff: %s" old-pos
new-pos diff)
+ ;; (message "Old pos %s, new pos: %s, diff: %s" old-pos
new-pos diff)
)))
- (message "Not looking at white-space"))))
+ ;; (message "Not looking at white-space")
+ )))
(apply old-function arguments)))
(defun phps-mode-functions-indent-line ()
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index ab14cc9..30ce7c7 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -856,6 +856,7 @@
(defun phps-mode-test-functions-whitespace-modifications ()
"Test white-space modifications functions."
+
(phps-mode-test-with-buffer
"<?php\n$var = 'abc';\n\n$var2 = '123';\n"
"Add newline between two assignments and inspect moved tokens and states"
@@ -869,6 +870,20 @@
'((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13)
(T_CONSTANT_ENCAPSED_STRING 14 . 19) (";" 19 . 20) (T_VARIABLE 23 . 28) ("=" 29
. 30) (T_CONSTANT_ENCAPSED_STRING 31 . 36) (";" 36 . 37))))
)
+ (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"
+ (message "Tokens %s" (phps-mode-lexer-get-tokens))
+ (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))))
+ (goto-char 54)
+ (newline-and-indent)
+ (message "Tokens %s" (phps-mode-lexer-get-tokens))
+ (should (equal (phps-mode-lexer-get-tokens)
+ '(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))))))
+ )
+
)
(defun phps-mode-test-functions ()
- [elpa] externals/phps-mode 4592bce 385/405: Only running newline heuristic when rest of line is whitespace, (continued)
- [elpa] externals/phps-mode 4592bce 385/405: Only running newline heuristic when rest of line is whitespace, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a14d5b2 399/405: Mode map is now loaded, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ff474c9 392/405: Work on invalid imenu, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode defa128 393/405: Passes unit test for imenu new structure, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a48386a 386/405: Do not allow failures on emacs snapshot, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3f20bd2 394/405: Updated tests and structure of hierarchical imenu, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ba7a3dc 381/405: Updated TODO list with travis integration completed, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3c959d3 404/405: Improved README, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 895105d 384/405: Updated emacs version requirement and travis build, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b7b778b 379/405: Updated Travis CI build script, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3d3003f 364/405: Started on test for newline-and-indent before white-space,
Stefan Monnier <=
- [elpa] externals/phps-mode 09a2123 372/405: Passes all tests for moving line-indent index, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a4b2f37 375/405: Added new TODO item, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7deefdc 383/405: Fixed use-package config example in README, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 65f79c8 397/405: Added map shortcuts for comment / uncomment region, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode dbd2825 389/405: Added unit test for multiple level namespaces and added support for it, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 5f52f54 395/405: Fixed compilation warning after new imenu structure, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 192f9ae 391/405: Fix issues with test list structure, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 21f883e 396/405: Updated README and copyright date, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f0912ee 398/405: Removed TODO and changed syntax color to be based on tokens only, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 47793f7 402/405: Updated README, Stefan Monnier, 2019/07/13