Fix phpinspect-buffer-index-functions test

master
Hugo Thunnissen 1 month ago
parent 2520c89680
commit 3fff772d8a

@ -356,38 +356,19 @@ class YYY {
(should (= 1 (hash-table-count (phpinspect-project-class-index (phpinspect-buffer-project buffer)))))))) (should (= 1 (hash-table-count (phpinspect-project-class-index (phpinspect-buffer-project buffer))))))))
(ert-deftest phpinspect-buffer-index-functions () (ert-deftest phpinspect-buffer-index-functions ()
(let ((buffer (phpinspect-make-buffer :-project (phpinspect--make-project :autoload (phpinspect-make-autoloader)))) (with-temp-buffer
(namespaces (phpinspect-make-splayt)) (let ((buffer (phpinspect-make-buffer
(declarations (phpinspect-make-splayt)) :buffer (current-buffer)
(classes (phpinspect-make-splayt)) :-project (phpinspect--make-project :autoload (phpinspect-make-autoloader)))))
(functions (phpinspect-make-splayt))) (insert "<?php
namespace NS;
(phpinspect-splayt-insert
namespaces 10
(phpinspect-make-meta nil 10 200 "" '(:namespace (:word "NS") (:terminator ";"))))
(phpinspect-splayt-insert
declarations 20
(phpinspect-make-meta nil 20 30 "" '(:declaration (:word "class") (:word "TestClass"))))
(phpinspect-splayt-insert
classes 20
(phpinspect-make-meta nil 20 70 "" '(:class (:declaration (:word "class") (:word "TestClass")))))
(phpinspect-splayt-insert
declarations 40
(phpinspect-make-meta nil 40 45 "" '(:declaration (:word "testMethod") (:list) (:word "RelativeType"))))
(phpinspect-splayt-insert
functions 40
(phpinspect-make-meta nil 40 50 "" '(:function (:declaration (:word "testMethod") (:list) (:word "RelativeType")))))
(phpinspect-buffer-index-declarations buffer declarations) class TestClass
(phpinspect-buffer-index-namespaces buffer namespaces) {
(phpinspect-buffer-index-classes buffer classes) function testMethod(): RelativeType {}
}")
(phpinspect-buffer-update-project-index buffer)
(phpinspect-buffer-index-functions buffer functions)
(should (phpinspect-project-get-class (should (phpinspect-project-get-class
(phpinspect-buffer-project buffer) (phpinspect-buffer-project buffer)
@ -405,7 +386,7 @@ class YYY {
(should (= 0 (hash-table-count (phpinspect--class-methods (should (= 0 (hash-table-count (phpinspect--class-methods
(phpinspect-project-get-class (phpinspect-project-get-class
(phpinspect-buffer-project buffer) (phpinspect-buffer-project buffer)
(phpinspect--make-type :name "\\NS\\TestClass")))))))) (phpinspect--make-type :name "\\NS\\TestClass")))))))))
(ert-deftest phpinspect-buffer-index-class-variables () (ert-deftest phpinspect-buffer-index-class-variables ()
(let ((buffer (phpinspect-make-buffer :-project (phpinspect--make-project :autoload (phpinspect-make-autoloader)))) (let ((buffer (phpinspect-make-buffer :-project (phpinspect--make-project :autoload (phpinspect-make-autoloader))))

Loading…
Cancel
Save