|
102 | 102 | (should (= exit-code 0))))) |
103 | 103 |
|
104 | 104 |
|
| 105 | +(ert-deftest eldev-autoloads-disabled-dependencies () |
| 106 | + (let ((eldev--test-project "project-j")) |
| 107 | + (eldev--test-delete-cache) |
| 108 | + (eldev--test-run nil ("prepare") |
| 109 | + (should (= exit-code 0))) |
| 110 | + ;; In real use, dependency `project-i' would be found from the project sources by |
| 111 | + ;; whoever sets `EMACSLOADPATH'. Here we hardcode it to simplify things. |
| 112 | + (let ((process-environment `(,(eldev--test-emacsloadpath (eldev--test-project-dir) (eldev--test-project-dir "project-i")) |
| 113 | + ,@process-environment))) |
| 114 | + ;; This would work without `--disable-dependencies', as the function should be |
| 115 | + ;; autoloaded. However, at least as of now, `--disable-dependencies' also disables |
| 116 | + ;; autoload handling. Codify this in tests to be reminded if this somehow changes. |
| 117 | + ;; `project-j' itself may or may not be loaded, depending on target `:autoloads' |
| 118 | + ;; being rebuilt (see also `eldev--unload-package' which is _not_ called when using |
| 119 | + ;; `--disable-dependencies'); so it fails either already on `project-j-hello', or |
| 120 | + ;; else on `project-i-hello'. |
| 121 | + (eldev--test-run nil ("--disable-dependencies" "eval" "--dont-require" `(project-j-hello)) |
| 122 | + (should (string-match-p "function definition is void.+project-[ij]-hello" stderr)) |
| 123 | + (should (= exit-code 1))) |
| 124 | + ;; Works only when requiring everything (`project-j' is autorequired by the command). |
| 125 | + (eldev--test-run nil ("--disable-dependencies" "eval" `(progn (require 'project-i) (project-j-hello))) |
| 126 | + (should (string= stdout "\"Hello\"\n")) |
| 127 | + (should (= exit-code 0)))))) |
| 128 | + |
| 129 | + |
105 | 130 | (provide 'test/autoloads) |
0 commit comments