[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 3f20bd2 394/405: Updated tests and structure
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 3f20bd2 394/405: Updated tests and structure of hierarchical imenu |
Date: |
Sat, 13 Jul 2019 10:01:00 -0400 (EDT) |
branch: externals/phps-mode
commit 3f20bd27ccb78728bed2853ac1fa646835ff4db1
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Updated tests and structure of hierarchical imenu
---
phps-mode-functions.el | 28 ++++++++--------------------
phps-mode-test-functions.el | 14 +++++++-------
2 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 0f9ff48..69563b6 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -241,8 +241,7 @@
(= imenu-open-namespace-level imenu-nesting-level)
imenu-in-namespace-name)
(let ((imenu-add-list (nreverse imenu-namespace-index)))
- ;; (message "Pushing %s to imenu-index" imenu-add-list)
- (push `(,imenu-in-namespace-name . ,(list
imenu-add-list)) imenu-index))
+ (push `(,imenu-in-namespace-name . ,imenu-add-list)
imenu-index))
(setq imenu-in-namespace-name nil))
(when (and imenu-open-class-level
@@ -250,14 +249,8 @@
imenu-in-class-name)
(let ((imenu-add-list (nreverse imenu-class-index)))
(if imenu-in-namespace-name
- (progn
- ;; (message "Pushing %s to imenu-namespace-index"
imenu-add-list)
- (push `(,imenu-in-class-name . ,(list
imenu-add-list)) imenu-namespace-index)
- ;; (message "Namespace-index is now %s"
imenu-namespace-index)
- )
- (push `(,imenu-in-class-name . ,imenu-add-list)
imenu-index)
- ;; (message "Pushing %s to imenu-index" imenu-add-list)
- ))
+ (push `(,imenu-in-class-name . ,imenu-add-list)
imenu-namespace-index)
+ (push `(,imenu-in-class-name . ,imenu-add-list)
imenu-index)))
(setq imenu-in-class-name nil))
(setq imenu-nesting-level (1- imenu-nesting-level))))
@@ -266,7 +259,6 @@
imenu-in-namespace-name
(not imenu-in-namespace-with-brackets))
(let ((imenu-add-list (nreverse imenu-namespace-index)))
- ;; (message "Pushing %s to imenu-index" imenu-add-list)
(push `(,imenu-in-namespace-name . ,imenu-add-list)
imenu-index))
(setq imenu-in-namespace-name nil))
@@ -280,9 +272,7 @@
(setq imenu-in-namespace-with-brackets (string= token "{"))
(setq imenu-open-namespace-level imenu-nesting-level)
(setq imenu-namespace-index '())
- (setq imenu-in-namespace-declaration nil)
- (let ((imenu-label (format "namespace %s"
imenu-in-namespace-name)))
- (push `(,imenu-label . ,imenu-in-namespace-index)
imenu-index)))
+ (setq imenu-in-namespace-declaration nil))
((and (or (equal token 'T_STRING)
(equal token 'T_NS_SEPARATOR))
@@ -295,11 +285,7 @@
((string= token "{")
(setq imenu-open-class-level imenu-nesting-level)
(setq imenu-in-class-declaration nil)
- (setq imenu-class-index '())
- (let ((imenu-label (format "class %s"
imenu-in-class-name)))
- (if imenu-in-namespace-name
- (push `(,imenu-label . ,imenu-in-class-index)
imenu-class-index)
- (push `(,imenu-label . ,imenu-in-class-index)
imenu-index))))
+ (setq imenu-class-index '()))
((and (equal token 'T_STRING)
(not imenu-in-class-name))
@@ -313,7 +299,9 @@
(string= token ";"))
(if imenu-in-class-name
(push `(,imenu-in-function-name .
,imenu-in-function-index) imenu-class-index)
- (push `(,imenu-in-function-name .
,imenu-in-function-index) imenu-index))
+ (if imenu-in-namespace-name
+ (push `(,imenu-in-function-name .
,imenu-in-function-index) imenu-namespace-index)
+ (push `(,imenu-in-function-name .
,imenu-in-function-index) imenu-index)))
(setq imenu-in-function-name nil)
(setq imenu-in-function-declaration nil))
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 74f2cf1..31a29c0 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -830,37 +830,37 @@
(phps-mode-test-with-buffer
"<?php\nclass myClass {\n public function myFunctionA() {}\n
protected function myFunctionB() {}\n}\n"
"Imenu object-oriented file"
- (should (equal (phps-mode-functions-get-imenu) '(("class myClass" . 13)
("myClass" . (("myFunctionA" . 43) ("myFunctionB" . 83)))))))
+ (should (equal (phps-mode-functions-get-imenu) '(("myClass" .
(("myFunctionA" . 43) ("myFunctionB" . 83)))))))
(phps-mode-test-with-buffer
"<?php\nnamespace myNamespace {\n class myClass {\n public
function myFunctionA() {}\n protected function myFunctionB() {}\n
}\n}\n"
"Imenu object-oriented file with namespace, class and function"
- (should (equal (phps-mode-functions-get-imenu) '(("namespace myNamespace" .
17) ("myNamespace" (("myClass" (("class myClass" . 41) ("myFunctionA" . 75)
("myFunctionB" . 119)))))))))
+ (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass"
("myFunctionA" . 75) ("myFunctionB" . 119)))))))
(phps-mode-test-with-buffer
"<?php\nnamespace myNamespace;\nclass myClass {\n public function
myFunctionA() {}\n protected function myFunctionB() {}\n}\n"
"Imenu object-oriented file with bracket-less namespace, class and function"
- (should (equal (phps-mode-functions-get-imenu) '(("namespace myNamespace" .
17) ("myNamespace" ("myClass" (("class myClass" . 36) ("myFunctionA" . 66)
("myFunctionB" . 106))))))))
+ (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass"
("myFunctionA" . 66) ("myFunctionB" . 106)))))))
(phps-mode-test-with-buffer
"<?php\nnamespace myNamespace {\n class myClass extends myAbstract {\n
public function myFunctionA() {}\n protected function myFunctionB()
{}\n }\n}\n"
"Imenu object-oriented file with namespace, class that extends and
functions"
- (should (equal (phps-mode-functions-get-imenu) '(("namespace myNamespace" .
17) ("myNamespace" (("myClass" (("class myClass" . 41) ("myFunctionA" . 94)
("myFunctionB" . 138)))))))))
+ (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass"
("myFunctionA" . 94) ("myFunctionB" . 138)))))))
(phps-mode-test-with-buffer
"<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements
myInterface {\n public function myFunctionA() {}\n protected function
myFunctionB() {}\n}\n"
"Imenu object-oriented file with bracket-less namespace, class that extends
and implements and functions"
- (should (equal (phps-mode-functions-get-imenu) '(("namespace myNamespace" .
17) ("myNamespace" ("myClass" (("class myClass" . 36) ("myFunctionA" . 108)
("myFunctionB" . 148))))))))
+ (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass"
("myFunctionA" . 108) ("myFunctionB" . 148)))))))
(phps-mode-test-with-buffer
"<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements
myInterface {\n public function myFunctionA($myArg = null) {}\n protected
function myFunctionB($myArg = 'abc') {}\n}\n"
"Imenu object-oriented file with bracket-less namespace, class that extends
and implements and functions with optional arguments"
- (should (equal (phps-mode-functions-get-imenu) '(("namespace myNamespace" .
17) ("myNamespace" ("myClass" (("class myClass" . 36) ("myFunctionA" . 108)
("myFunctionB" . 161))))))))
+ (should (equal (phps-mode-functions-get-imenu) '(("myNamespace" ("myClass"
("myFunctionA" . 108) ("myFunctionB" . 161)))))))
(phps-mode-test-with-buffer
"<?php\nnamespace myNamespace\\myNamespace2;\nclass myClass extends
myAbstract implements myInterface {\n public function myFunctionA($myArg =
null) {}\n protected function myFunctionB($myArg = 'abc') {}\n}\n"
"Imenu object-oriented file with bracket-less namespace with multiple
levels, class that extends and implements and functions with optional arguments"
- (should (equal (phps-mode-functions-get-imenu) '(("namespace
myNamespace\\myNamespace2" . 29) ("myNamespace\\myNamespace2" ("myClass"
(("class myClass" . 49) ("myFunctionA" . 121) ("myFunctionB" . 174))))))))
+ (should (equal (phps-mode-functions-get-imenu)
'(("myNamespace\\myNamespace2" ("myClass" ("myFunctionA" . 121) ("myFunctionB"
. 174)))))))
)
- [elpa] externals/phps-mode 07ed24d 376/405: Added states test as well, (continued)
- [elpa] externals/phps-mode 07ed24d 376/405: Added states test as well, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 92e53e8 363/405: Passes test for pressing newline before white-spaces just moves meta-data, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f2ff34a 378/405: Added TODO items for making changes inside tokens and not triggered a full re-lexing, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d416443 371/405: Added more test for moving line-indent index, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 22f75ba 362/405: Advice is running again in unit test, Stefan Monnier, 2019/07/13
- [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 <=
- [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, 2019/07/13
- [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