[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phpinspect 0c0c1ca381 059/126: Add test for phpinspect-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/phpinspect 0c0c1ca381 059/126: Add test for phpinspect-get-pattern-type-in-block |
Date: |
Sat, 12 Aug 2023 00:58:44 -0400 (EDT) |
branch: externals/phpinspect
commit 0c0c1ca3812e10466658cb8990590cf4c54d351e
Author: Hugo Thunnissen <devel@hugot.nl>
Commit: Hugo Thunnissen <devel@hugot.nl>
Add test for phpinspect-get-pattern-type-in-block
---
test/phpinspect-test.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/test/phpinspect-test.el b/test/phpinspect-test.el
index 478ecc13fa..75f149fac0 100644
--- a/test/phpinspect-test.el
+++ b/test/phpinspect-test.el
@@ -82,6 +82,28 @@
(should (phpinspect--type= (phpinspect--make-type :name "\\DateTime")
result)))))
+(ert-deftest phpinspect-get-pattern-type-in-block ()
+ (let* ((tokens (phpinspect-parse-string "class Foo { function a(\\Thing
$baz) { $foo = new \\DateTime(); $this->potato = $foo;"))
+ (context (phpinspect--get-resolvecontext tokens))
+ (project-root "could never be a real project root")
+ (phpinspect-project-root-function
+ (lambda (&rest _ignored) project-root))
+ (project (phpinspect--make-project
+ :fs (phpinspect-make-virtual-fs)
+ :root project-root
+ :worker (phpinspect-make-worker))))
+
+ (puthash project-root project (phpinspect--cache-projects
phpinspect-cache))
+
+ (let ((result (phpinspect-get-pattern-type-in-block
+ context (phpinspect--make-pattern :m `(:variable "this")
+ :m `(:object-attrib
(:word "potato")))
+ (phpinspect-function-block
+ (car (phpinspect--resolvecontext-enclosing-tokens
context)))
+ (phpinspect--make-type-resolver-for-resolvecontext
context))))
+ (should (phpinspect--type= (phpinspect--make-type :name "\\DateTime")
+ result)))))
+
(ert-deftest phpinspect-get-variable-type-in-block-array-access ()
(let* ((tokens (phpinspect-parse-string "class Foo { function a(\\Thing
$baz) { $foo = []; $foo[] = $baz; $bar = $foo[0];"))
(context (phpinspect--get-resolvecontext tokens))
- [elpa] externals/phpinspect ad12203a91 003/126: Add more parts of phpns that were apparently still required, (continued)
- [elpa] externals/phpinspect ad12203a91 003/126: Add more parts of phpns that were apparently still required, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect d6c63ef6f4 004/126: Truncate "uses_own" index file before filling the index, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect bbc37bea32 007/126: Update README code format and to use setq-local, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect f7c2a49b25 008/126: Remove dependency on php-project.el, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 098146bfc5 014/126: Add resolvecontext structure and optimze type resolving process, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect e07e1ed9e6 033/126: WIP: Split code up into separate files, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 6b8db3a318 028/126: Test and fix eldoc function for static methods, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 4c2b3dd601 019/126: Only attempt to return the inside class name when it is non-nil, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect a2ce841555 038/126: WIP: Make index thread block/wakeup when queue is empty/populated, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 56eaa3b36d 046/126: Replace index-thread with more generic and encapsulated worker type, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 0c0c1ca381 059/126: Add test for phpinspect-get-pattern-type-in-block,
ELPA Syncer <=
- [elpa] externals/phpinspect ca8d0972ff 050/126: Implement psr-0 and psr-4 autoloaders, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 1f145665ef 083/126: Exclude "return" from resolvecontext subject + count comma at point for eldoc arg number, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 0ca527dbbd 070/126: Adapt `phpinspect-purge-parser-cache' to new parser caching approach, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 6627f6f76f 073/126: Remove commented parser code, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect e270729e14 088/126: Implement splay tree for overlay storage/lookup, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 94d5b75455 107/126: Add `phpinspect-pipeline-pause-time', ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect e8f486f095 013/126: Improve codestyle and documentation + add tests for indexation, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect c0786db131 040/126: WIP: Index every possibly required type ahead of time., ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 2e487e7810 039/126: Fix resolving of function argument types, ELPA Syncer, 2023/08/12
- [elpa] externals/phpinspect 2fd575dbf5 044/126: Add drone.yml, ELPA Syncer, 2023/08/12