You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
phpinspect.el/test/util/generate-test-data.el

23 lines
880 B
EmacsLisp

(require 'phpinspect)
(let ((here (file-name-directory
(or load-file-name
buffer-file-name))))
(dolist (file (directory-files (concat here "/../fixtures" ) t "\\.php$"))
(with-temp-buffer
(insert-file-contents-literally file)
(let ((result (phpinspect-parse-current-buffer)))
(with-temp-buffer
(insert (prin1-to-string result))
(write-file (concat (string-remove-suffix ".php" file) ".eld"))))))
(dolist (class '("IndexClass1" "IndexClass2"))
(let ((index-class
(with-temp-buffer
(insert-file-contents-literally (concat here "/../fixtures/" class ".eld"))
(read (current-buffer)))))
(with-temp-buffer
(insert (prin1-to-string (phpinspect--index-tokens index-class)))
(write-file (concat here "/../fixtures/" class "-indexed.eld"))))))