2018-06-15 03:31:54 +02:00
|
|
|
;; -*- no-byte-compile: t; -*-
|
2019-09-03 00:41:03 -04:00
|
|
|
;;; core/test/test-core-projects.el
|
2018-06-15 03:31:54 +02:00
|
|
|
|
|
|
|
(describe "core/projects"
|
2019-09-03 00:41:03 -04:00
|
|
|
:var (projectile-enable-caching)
|
|
|
|
|
|
|
|
(require 'core-projects)
|
|
|
|
(require 'projectile)
|
|
|
|
|
|
|
|
(before-each
|
|
|
|
(setq projectile-enable-caching nil)
|
|
|
|
(projectile-mode +1))
|
|
|
|
(after-each
|
|
|
|
(projectile-mode -1))
|
2018-06-15 03:31:54 +02:00
|
|
|
|
|
|
|
(describe "project-p"
|
|
|
|
(it "Should detect when in a valid project"
|
2018-09-28 13:54:20 -04:00
|
|
|
(expect (doom-project-p doom-emacs-dir)))
|
2018-06-15 03:31:54 +02:00
|
|
|
(it "Should detect when not in a valid project"
|
2018-09-28 13:54:20 -04:00
|
|
|
(expect (doom-project-p (expand-file-name "~")) :to-be nil)))
|
2018-06-15 03:31:54 +02:00
|
|
|
|
|
|
|
(describe "project-root"
|
|
|
|
(it "should resolve to the project's root"
|
2018-09-28 13:54:20 -04:00
|
|
|
(expect (doom-project-root doom-core-dir) :to-equal doom-emacs-dir))
|
2018-09-28 21:25:18 -04:00
|
|
|
(it "should return nil if not in a project"
|
|
|
|
(expect (doom-project-root (expand-file-name "~")) :to-be nil)))
|
2018-06-15 03:31:54 +02:00
|
|
|
|
|
|
|
(describe "project-expand"
|
|
|
|
(it "expands to a path relative to the project root"
|
2018-09-28 13:54:20 -04:00
|
|
|
(expect (doom-project-expand "init.el" doom-core-dir)
|
|
|
|
:to-equal (expand-file-name "init.el" (doom-project-root doom-core-dir)))))
|
2018-06-15 03:31:54 +02:00
|
|
|
|
|
|
|
(describe "project-file-exists-p!"
|
|
|
|
(let ((default-directory doom-core-dir))
|
|
|
|
;; Resolve from project root
|
|
|
|
(expect (project-file-exists-p! "init.el"))
|
|
|
|
;; Chained file checks
|
|
|
|
(expect (project-file-exists-p! (and "init.el" "LICENSE")))
|
|
|
|
(expect (project-file-exists-p! (or "init.el" "does-not-exist")))
|
|
|
|
(expect (project-file-exists-p! (and "init.el" (or "LICENSE" "does-not-exist")))))))
|