[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode e95df1027b 042/212: Reverted old tests for im
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode e95df1027b 042/212: Reverted old tests for imenu and bookkeeping for lex-analyzer |
Date: |
Wed, 26 Jan 2022 01:50:38 -0500 (EST) |
branch: externals/phps-mode
commit e95df1027b0074ab3fe5ae3e52216a95f3de7b11
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Reverted old tests for imenu and bookkeeping for lex-analyzer
---
Makefile | 2 +-
test/phps-mode-test-lex-analyzer.el | 96 +++++++++++++++++++++++++++++++++++++
2 files changed, 97 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index f425653679..844be30ae6 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ compile:
find . -name "*.el" -exec $(EMACS_CMD) -f batch-byte-compile {} \;
.PHONY: tests
-tests: test-integration test-lexer test-lex-analyzer test-parser
test-syntax-table test-ast
+tests: test-integration test-lexer test-lex-analyzer test-parser
test-syntax-table #test-ast
.PHONY: test-ast
test-ast:
diff --git a/test/phps-mode-test-lex-analyzer.el
b/test/phps-mode-test-lex-analyzer.el
index 9fc97908ab..172eec894d 100644
--- a/test/phps-mode-test-lex-analyzer.el
+++ b/test/phps-mode-test-lex-analyzer.el
@@ -1156,6 +1156,101 @@
)
+(defun phps-mode-test-lex-analyzer--imenu ()
+ "Test for imenu."
+
+ (phps-mode-test--with-buffer
+ "<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n$var =
function () {\n echo 'here';\n};"
+ "Imenu function-oriented file with anonymous function"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myFunctionA" . 16)
("myFunctionB" . 42)))))
+
+ (phps-mode-test--with-buffer
+ "<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n"
+ "Imenu function-oriented file"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myFunctionA" . 16)
("myFunctionB" . 42)))))
+
+ (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-lex-analyzer--get-imenu) '(("myClass" .
(("myFunctionA" . 43) ("myFunctionB" . 83)))))))
+
+ (phps-mode-test--with-buffer
+ "<?php\ninterface myInterface {\n public function myFunctionA() {}\n
protected function myFunctionB() {}\n}\n"
+ "Imenu object-oriented file with interface"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myInterface" .
(("myFunctionA" . 51) ("myFunctionB" . 91)))))))
+
+ (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-lex-analyzer--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-lex-analyzer--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-lex-analyzer--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-lex-analyzer--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-lex-analyzer--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-lex-analyzer--get-imenu)
'(("myNamespace\\myNamespace2" ("myClass" ("myFunctionA" . 121) ("myFunctionB"
. 174)))))))
+
+ (phps-mode-test--with-buffer
+ "<?php\nclass myClass\n{\n\n public function myFunction1()\n {\n
echo \"my string with variable {$variable} inside it\";\n }\n\n public
function myFunction2()\n {\n }\n\n}"
+ "Imenu with double quoted string with variable inside it"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myClass"
("myFunction1" . 44) ("myFunction2" . 153))))))
+
+ (phps-mode-test--with-buffer
+ "<?php\n\nnamespace MyNamespace;\n\nclass MyClass\n{\n\n /**\n *\n
*/\n public function __construct()\n {\n if ($test) {\n
}\n }\n\n /**\n *\n */\n public function myFunction1()\n
{\n $this->addMessage(\"My random {$message} here\" . ($random > 1 ?
\"A\" : \"\") . \" was here.\");\n }\n \n /**\n *\n */\n
public function myFunction2()\n {\n }\n\n /**\n * It's good\n
*/\n public function my [...]
+ "Imenu with double quoted string with variable inside it and concatenated
string"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) '(("MyNamespace"
("MyClass" ("__construct" . 92) ("myFunction1" . 193) ("myFunction2" . 365)
("myFunction3" . 445) ("myFunction4" . 515)))))))
+
+ (phps-mode-test--with-buffer
+ "<?php\nclass myClass {}"
+ "Imenu empty class"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) nil)))
+
+ (phps-mode-test--with-buffer
+ "<?php\nnamespace myNamespace {}"
+ "Imenu empty bracketed namespace"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) nil)))
+
+ (phps-mode-test--with-buffer
+ "<?php\nnamespace myNamespace;"
+ "Imenu empty namespace without brackets"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) nil)))
+
+ (phps-mode-test--with-buffer
+ "<?php\ninterface myInterface\n{\n function myFunction1();\n function
myFunction2($x); // NOTE Imenu not working either\n}\n"
+ "Imenu in interface class with arguments in one method"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) '(("myInterface"
("myFunction1" . 44) ("myFunction2" . 72))))))
+
+ (phps-mode-test--with-buffer
+ "<?php\n\nnamespace MyNamespace;\n\nfunction aFunction() {\n /**\n *
With some contents\n */\n}\n\nclass MyClass\n{\n\n /**\n *\n
*/\n public function __construct()\n {\n if ($test) {\n }\n
}\n\n /**\n *\n */\n public function myFunction1()\n {\n
$this->addMessage(\"My random {$message} here\" . ($random > 1 ? \"A\" :
\"\") . \" was here.\");\n }\n \n /**\n *\n */\n public
function myFunction2()\n [...]
+ "Imenu with double quoted string with variable inside it and concatenated
string"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) '(("MyNamespace"
("aFunction" . 41) ("MyClass" ("__construct" . 160) ("myFunction1" . 261)
("myFunction2" . 433) ("myFunction3" . 513) ("myFunction4" . 583)))))))
+
+ (phps-mode-test--with-buffer
+ "<?php\n\nnamespace MyNamespaceA\n{\n function aFunctionA() {\n
/**\n * With some contents\n */\n }\n class MyClass\n
{\n\n /**\n *\n */\n public function
__construct()\n {\n if ($test) {\n }\n
}\n\n /**\n *\n */\n public function
myFunction1()\n {\n $this->addMessage(\"My random {$message}
here\" . ($random > 1 ? \"A\" : \"\") . \" was he [...]
+ "Imenu with double quoted string with variable inside it and concatenated
string in two namespaces"
+ (should (equal (phps-mode-lex-analyzer--get-imenu) '(("MyNamespaceA"
("aFunctionA" . 46) ("MyClass" ("__construct" . 205) ("myFunction1" . 338)
("myFunction2" . 542) ("myFunction3" . 646) ("myFunction4" . 740)))
("aFunctionB" . 807) ("MyClass" ("__construct" . 925) ("myFunction1" . 1058)
("myFunction2" . 1262) ("myFunction3" . 1366) ("myFunction4" . 1460))))))
+
+ )
+
(defun phps-mode-test-lex-analyzer--get-moved-imenu ()
"Test for moving imenu index."
@@ -1559,6 +1654,7 @@
(phps-mode-test-lex-analyzer--get-lines-indent-psr-2)
(phps-mode-test-lex-analyzer--get-lines-indent)
(phps-mode-test-lex-analyzer--indent-line)
+ (phps-mode-test-lex-analyzer--imenu)
(phps-mode-test-lex-analyzer--get-moved-imenu)
(phps-mode-test-lex-analyzer--comment-uncomment-region))
- [elpa] externals/phps-mode ef97058a67 184/212: Added more tests for indentation helper functions, (continued)
- [elpa] externals/phps-mode ef97058a67 184/212: Added more tests for indentation helper functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a1af5b11fb 040/212: More work on bookkeeping of class properties via AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4dc07c9041 050/212: Bookkeeping via AST working with assigned variables from array, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4d226f18cc 048/212: Bookkeeping via AST working with referenced foreach variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5603e6266b 047/212: SDT for array values, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 787d82313e 045/212: Bookkeeping via AST now tracks variables around inline-functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a629baba89 053/212: More work on bookkeeping via AST for arrow function variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode df0b707a61 044/212: Added parser SDT for inline-function, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 432382eddb 051/212: Added bookkeeping support for global variables in functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode bb381d8127 041/212: Bookkeeping of class properties via AST passed test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e95df1027b 042/212: Reverted old tests for imenu and bookkeeping for lex-analyzer,
Christian Johansson <=
- [elpa] externals/phps-mode a65c8af308 008/212: Extract ast code into separate file and test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 23c001c33f 037/212: Moved parser SDT to separate file, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 261121f096 056/212: Fixed incorrect information in debug output in test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e8a47de694 052/212: Work on supported arrow functions for bookkeeping via AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5686703a6b 074/212: Passing bookkeeping via AST for $this inside arrow function body inside class method, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a9d0e941df 066/212: Started on SDT for static variables statement, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a8fecdfd68 055/212: Bookkeeping of variables inside arrow functions now working, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e42646dc3a 058/212: Added SDT for isset() and empty(), Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 9ad46d061e 057/212: Bookkeeping via AST passing two more tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 806bb902b3 122/212: Improved indentation for chaining objects, Christian Johansson, 2022/01/26