diff options
| author | lWarne <laurencewarne@gmail.com> | 2021-04-24 17:44:12 +0100 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2021-05-03 10:38:39 +0300 |
| commit | cce1ddd0b77711b44ef4fde4014985d94281e59e (patch) | |
| tree | 6fb3a27374e08200548814ad3f47ae5d42f22762 | |
| parent | 54cdaf6c39fb88042f5c996741bad03b2c26c912 (diff) | |
Add tests for added functions.
Add tests for projectile-update-project-types which verify that it
updates existing projects. Add tests for projectile--combine-lists
which test its overriding logic and that it ignores nil values in
secondary plists.
| -rw-r--r-- | test/projectile-test.el | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/projectile-test.el b/test/projectile-test.el index f4b6ea0..d5f6962 100644 --- a/test/projectile-test.el +++ b/test/projectile-test.el @@ -162,6 +162,20 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'. (expect (projectile-expand-root "foo/bar") :to-equal "/path/to/project/foo/bar") (expect (projectile-expand-root "./foo/bar") :to-equal "/path/to/project/foo/bar"))) +(describe "projectile--combine-plists" + (it "Items in second plist override elements in first" + (expect (projectile--combine-plists + '(:foo "foo" :bar "bar") + '(:foo "foo" :bar "foo" :foobar "foobar")) + :to-equal + '(:foo "foo" :bar "foo" :foobar "foobar"))) + (it "Nil elements in second plist do not override elements in first" + (expect (projectile--combine-plists + '(:foo "foo" :bar "bar") + '(:foo "foo" :bar nil :foobar "foobar")) + :to-equal + '(:foo "foo" :bar "bar" :foobar "foobar")))) + (describe "projectile-register-project-type" (it "prepends new projects to projectile-project-types" (projectile-register-project-type 'foo '("Foo")) @@ -169,6 +183,42 @@ Just delegates OPERATION and ARGS for all operations except for`shell-command`'. (projectile-register-project-type 'bar '("Bar")) (expect (caar projectile-project-types) :to-equal 'bar))) +(describe "projectile-update-project-type" + :var ((mock-projectile-project-types + '((foo marker-files "marker-file" + project-file "project-file" + compilation-dir "compilation-dir" + configure-command "configure" + compile-command "compile" + test-command "test" + install-command "install" + package-command "package" + run-command "run")))) + (it "Updates existing project in projectile-project-types" + (let ((projectile-project-types mock-projectile-project-types)) + (projectile-update-project-type + 'foo + :marker-files "marker-file2" + :test-suffix "suffix") + (expect projectile-project-types :to-equal + '((foo marker-files "marker-file2" + project-file "project-file" + compilation-dir "compilation-dir" + configure-command "configure" + compile-command "compile" + test-command "test" + install-command "install" + package-command "package" + run-command "run" + test-suffix "suffix"))))) + (it "Error when attempt to update nonexistant project type" + (let ((projectile-project-types mock-projectile-project-types)) + (expect (projectile-update-project-type + 'bar + :marker-files "marker-file" + :test-suffix "suffix") + :to-throw)))) + (describe "projectile-project-type" (it "detects the type of Projectile's project" (expect (projectile-project-type) :to-equal 'emacs-eldev)) |
