switch project fix
This commit is contained in:
@@ -187,6 +187,20 @@ real org-roam database is opened globally."
|
||||
(should (consp ctx))
|
||||
(should (string-suffix-p "my-custom.db" (cdr ctx)))))))
|
||||
|
||||
(ert-deftest orp-test-context-via-directory-override ()
|
||||
"Context is detected via `project-current-directory-override' (Emacs 29+).
|
||||
Simulates the environment created by `project-switch-project': the
|
||||
override is set to the target project while `default-directory' still
|
||||
points elsewhere (e.g. the previously active project)."
|
||||
(skip-unless (boundp 'project-current-directory-override))
|
||||
(orp-test--with-initialized-project
|
||||
(let ((project-current-directory-override test-root)
|
||||
(default-directory "/")) ; deliberately wrong — not the project
|
||||
(let ((ctx (org-roam-project--context)))
|
||||
(should (consp ctx))
|
||||
(should (string= (file-name-as-directory (car ctx))
|
||||
(file-name-as-directory test-notes-dir)))))))
|
||||
|
||||
;;; ─── 5. org-roam-project--with-context (macro) ──────────────────────────────
|
||||
|
||||
(ert-deftest orp-test-with-context-binds-org-roam-vars ()
|
||||
@@ -246,6 +260,19 @@ real org-roam database is opened globally."
|
||||
(expand-file-name org-roam-project-db-filename
|
||||
test-notes-dir))))))
|
||||
|
||||
(ert-deftest orp-test-require-context-via-directory-override ()
|
||||
"require-context succeeds via `project-current-directory-override' (Emacs 29+).
|
||||
Simulates `project-switch-project' setting the override while
|
||||
`default-directory' still points to the previous project."
|
||||
(skip-unless (boundp 'project-current-directory-override))
|
||||
(orp-test--with-initialized-project
|
||||
(let ((project-current-directory-override test-root)
|
||||
(default-directory "/")) ; deliberately wrong — not the project
|
||||
(let ((ctx (org-roam-project--require-context)))
|
||||
(should (consp ctx))
|
||||
(should (string= (file-name-as-directory (car ctx))
|
||||
(file-name-as-directory test-notes-dir)))))))
|
||||
|
||||
;;; ─── 7. org-roam-project--add-to-gitignore ──────────────────────────────────
|
||||
|
||||
(ert-deftest orp-test-gitignore-no-file ()
|
||||
|
||||
Reference in New Issue
Block a user