[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode f791cee 234/405: Started on unit tests for im
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode f791cee 234/405: Started on unit tests for imenu-index generation |
Date: |
Sat, 13 Jul 2019 10:00:20 -0400 (EDT) |
branch: externals/phps-mode
commit f791ceef1637061fb8c03eab7ca11f0059fc8a19
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Started on unit tests for imenu-index generation
---
README.md | 6 +++---
phps-mode-functions.el | 14 +++++++++++++-
phps-mode-test-functions.el | 12 +++++++++++-
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 591df05..31efe01 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ If you have emacs at a customized location prefix the
commands with your path, i
### Lexer
-Token generation
+Semantic token generation.
``` bash
make test-lexer
@@ -38,7 +38,7 @@ make test-lexer
### Parser
-Not ready yet.
+Semantic grammar. Not ready yet.
``` bash
make test-parser
@@ -46,7 +46,7 @@ make test-parser
### Functions
-Indentations, imenu, semantic subsystem
+Indentations, imenu.
``` bash
make test-functions
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 8e14b43..eba4714 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -618,12 +618,24 @@
;; (message "phps-mode-functions-after-change %s %s %s" start stop length)
))
+;; TODO Implement this
+(defun phps-mode-functions-imenu-create-index-function ()
+ "Create index for imenu."
+ (let ((index '()))
+
+ ;; TODO Iterate namespaces, classes and functions and add to index
+
+ index))
+
(defun phps-mode-functions-init ()
"PHP specific init-cleanup routines."
- ;; indent-region will call this on each line of region
+ ;; NOTE Indent-region will call this on each line of region
(set (make-local-variable 'indent-line-function)
#'phps-mode-functions-indent-line)
+ ;; Support Imenu
+ (set (make-local-variable 'imenu-create-index-function)
#'phps-mode-functions-imenu-create-index-function)
+
(when (and (boundp 'phps-mode-use-psr-2)
phps-mode-use-psr-2)
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 47da2bc..1de7fdf 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -583,6 +583,15 @@
)
+(defun phps-mode-test-functions-imenu ()
+ "Test for imenu"
+ (phps-mode-test-with-buffer
+ "<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n"
+ "Imenu function-oriented file"
+ (should (equal (phps-mode-functions-imenu-create-index-function)
'(("myFunctionA" . 16) ("myFunction B" . 42))))
+ )
+ )
+
;; TODO Add tests for all examples here: https://www.php-fig.org/psr/psr-2/
(defun phps-mode-test-functions ()
@@ -596,7 +605,8 @@
(phps-mode-test-functions-get-lines-indent-multi-line-assignments)
(phps-mode-test-functions-get-lines-indent-switch-case)
(phps-mode-test-functions-get-lines-indent)
- (phps-mode-test-functions-indent-line))
+ (phps-mode-test-functions-indent-line)
+ (phps-mode-test-functions-imenu))
(phps-mode-test-functions)
- [elpa] externals/phps-mode d754163 221/405: More work on multi-line token-less lines, (continued)
- [elpa] externals/phps-mode d754163 221/405: More work on multi-line token-less lines, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8947e6e 202/405: Conceptual work on indentation-calculation for multi-line assignment, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode fc2e8b7 212/405: Added logic to indent token-less lines as well, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8707777 237/405: Updated README, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2d4646f 203/405: Work on inline control structure indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 202827b 198/405: New indentation algorithm now supports inline control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b2a5700 218/405: Fixed indentation for multi-line optional function arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f7186a1 239/405: Preparations for hierarchical imenu, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 43bf350 216/405: Added tests for token-less lines, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0de10fa 235/405: Passes first test for imenu, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f791cee 234/405: Started on unit tests for imenu-index generation,
Stefan Monnier <=
- [elpa] externals/phps-mode b56a15c 233/405: Removed debugging output, updated todo items, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 73784d0 225/405: Cleaned up tests for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f7e7c74 219/405: Work on indentation for switch-case, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c2af31e 240/405: Imenu support now shows hierarchical information, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 55953de 232/405: Lexer now doesn't find keywords in function names, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b8e9449 247/405: Refactored Imenu to use a persistent variable per buffer, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 67b8701 244/405: Decreased length of imenu items to prevent truncation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e78d8ed 248/405: Clean-up of indentation code, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c2db7d3 250/405: Preparations for integration test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 11309b8 256/405: Updated readme, Stefan Monnier, 2019/07/13