[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 2d2aaad 388/405: Added failing unit test
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 2d2aaad 388/405: Added failing unit test |
Date: |
Sat, 13 Jul 2019 10:00:59 -0400 (EDT) |
branch: externals/phps-mode
commit 2d2aaad9e6b03c76cf7c75ea0b26b6c67221311b
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Added failing unit test
---
README.md | 7 ++++---
phps-mode-functions.el | 13 ++++++-------
phps-mode-test-functions.el | 9 +++++++--
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 2f3bbd5..279e20c 100644
--- a/README.md
+++ b/README.md
@@ -16,16 +16,17 @@ This mode does not require PHP installed on your computer
because it has a built
* Lexer based on official PHP re2c lexer (100%)
* Syntax coloring based on lexer tokens (100%)
* PSR-1 and PSR-2 indentation based on lexer tokens (100%)
-* Imenu support (100%)
+* Imenu support (90%)
* Integration with `(electric-pair)` (100%)
* Incremental lexer and syntax coloring after buffer changes (100%)
* Incremental indentation and imenu calculation after buffer changes (100%)
* Supports `(comment-region)` and `(uncomment-region)` (100%)
* Travis support (100%)
-* A set of heuristics to improve large-file incremental change handling (20%)
+* A set of heuristics to improve large-file incremental change handling (50%)
* Wisent LALR parser based on official PHP yacc parser automatically converted
grammar (50%)
-* Approach flycheck about including support for this module by default (0%)
* Full integration with Emacs Semantic subsystem (30%)
+* Approach flycheck about including support for this module by default (0%)
+* Eldoc support (0%)
* Flymake support (0%)
* PSR-2 auto-formatting tool based on lexer tokens (0%)
* Add to MELPA (0%)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 282492a..033de69 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -1,6 +1,6 @@
;;; phps-mode-functions.el --- Mode functions for PHPs -*- lexical-binding: t
-*-
-;; Copyright (C) 2018 Christian Johansson
+;; Copyright (C) 2018-2019 Christian Johansson
;; This file is not part of GNU Emacs.
@@ -46,10 +46,6 @@
(defvar phps-mode-functions-verbose nil
"Verbose messaging, default nil.")
-
-;; NOTE Also format white-space inside the line, i.e. after function
declarations?
-
-
(defun phps-mode-functions-get-buffer-changes-start ()
"Get buffer change start."
phps-mode-functions-buffer-changes-start)
@@ -222,14 +218,17 @@
(when phps-mode-functions-verbose
(message "Token '%s' pos: %s-%s lines: %s-%s" next-token
next-token-start next-token-end next-token-start-line-number
next-token-end-line-number)))
- ;; Token logic
+ ;; Token logic - we have one token look-ahead at this point
(when token
+
;; IMENU LOGIC
(cond
+
((string= token "{")
(setq imenu-nesting-level (1+ imenu-nesting-level)))
+
((string= token "}")
(when (and imenu-open-namespace-level
@@ -314,6 +313,7 @@
(setq imenu-in-function-name nil)
(setq imenu-in-function-declaration t)))))
+
;; INDENTATION LOGIC
;; Keep track of round bracket level
@@ -1054,7 +1054,6 @@
;; Support for change detection
(add-hook 'after-change-functions #'phps-mode-functions-after-change))
-
(provide 'phps-mode-functions)
;;; phps-mode-functions.el ends here
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index ced802e..4bea144 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -1,6 +1,6 @@
;;; phps-mode-test-functions.el --- Tests for functions -*- lexical-binding: t
-*-
-;; Copyright (C) 2018 Christian Johansson
+;; Copyright (C) 2018-2019 Christian Johansson
;; This file is not part of GNU Emacs.
@@ -857,6 +857,11 @@
"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) '(("\\myNamespace" . 17)
("\\myNamespace\\myClass" . 36) ("\\myNamespace\\myClass->myFunctionA()" . 108)
("\\myNamespace\\myClass->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, class that extends
and implements and functions with optional arguments"
+ (should (equal (phps-mode-functions-get-imenu)
'(("\\myNamespace\\myNamespace2" . 17) ("\\myNamespace\\myClass" . 50)
("\\myNamespace\\myClass->myFunctionA()" . 122)
("\\myNamespace\\myClass->myFunctionB()" . 175)))))
+
)
(defun phps-mode-test-functions-comment-uncomment-region ()
@@ -957,7 +962,7 @@
(defun phps-mode-test-functions ()
"Run test for functions."
- (setq debug-on-error t)
+ ;; (setq debug-on-error t)
;; (setq phps-mode-functions-verbose t)
(phps-mode-test-functions-get-lines-indent-if)
(phps-mode-test-functions-get-lines-indent-classes)
- [elpa] externals/phps-mode 09a2123 372/405: Passes all tests for moving line-indent index, (continued)
- [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
- [elpa] externals/phps-mode 2d2aaad 388/405: Added failing unit test,
Stefan Monnier <=
- [elpa] externals/phps-mode fa47a17 390/405: Changed imenu index to a hierarchical structure, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d05601b 387/405: Updated documents, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 07d9176 403/405: Improved flycheck support, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 1d58896 400/405: Minimal mode map is now loaded, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 11e151a 382/405: Fixed linting issues in flycheck file, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 808f679 401/405: Moved TODO to separate doc and improved syntax coloring, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f5c2072 405/405: Updated copyright for inclusion in ELPA, Stefan Monnier, 2019/07/13