aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2018-10-01 11:27:22 +0300
committerBozhidar Batsov <bozhidar@batsov.com>2018-10-01 11:27:22 +0300
commitfac03cfb4bda15a2925c03a3f2a4f836e819f146 (patch)
tree717f9c631cb4e2bddb46809496e0e86a1ff5b21c /test
parentbdecec478786ac750981ea8d9d8db8fab918993c (diff)
Start migrating the tests to buttercup
Working with ERT is just too painful and it's a bit part of the reason our test suite is in such a sorry state right now. Let's start fresh and create a new cleaner, more comprehensive and nicer test suite using a more capable framework.
Diffstat (limited to 'test')
-rw-r--r--test/projectile-legacy-test.el10
-rw-r--r--test/projectile-test.el41
2 files changed, 41 insertions, 10 deletions
diff --git a/test/projectile-legacy-test.el b/test/projectile-legacy-test.el
index 0f69c9e..49188fe 100644
--- a/test/projectile-legacy-test.el
+++ b/test/projectile-legacy-test.el
@@ -39,16 +39,6 @@
(noflet ((projectile-project-name () "project"))
(should (equal (projectile-project-name) "project"))))
-(ert-deftest projectile-test-prepend-project-name ()
- (noflet ((projectile-project-name () "project"))
- (should (equal (projectile-prepend-project-name "Test") "[project] Test"))))
-
-(ert-deftest projectile-test-expand-root ()
- (noflet ((projectile-project-root () "/path/to/project"))
- (should (equal (projectile-expand-root "foo") "/path/to/project/foo"))
- (should (equal (projectile-expand-root "foo/bar") "/path/to/project/foo/bar"))
- (should (equal (projectile-expand-root "./foo/bar") "/path/to/project/foo/bar"))))
-
(ert-deftest projectile-test-ignored-directory-p ()
(noflet ((projectile-ignored-directories () '("/path/to/project/tmp" "/path/to/project/t\\.*")))
(should (projectile-ignored-directory-p "/path/to/project/tmp"))
diff --git a/test/projectile-test.el b/test/projectile-test.el
new file mode 100644
index 0000000..d876800
--- /dev/null
+++ b/test/projectile-test.el
@@ -0,0 +1,41 @@
+;;; projectile-test.el
+
+;; Copyright © 2018 Bozhidar Batsov
+
+;; Author: Bozhidar Batsov <bozhidar@batsov.com>
+
+;; This file is NOT part of GNU Emacs.
+
+;; This program is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see `http://www.gnu.org/licenses/'.
+
+;;; Commentary:
+
+;; This file is part of Projectile.
+
+;;; Code:
+
+(require 'projectile)
+(require 'buttercup)
+
+(describe "projectile-prepend-project-name"
+ (it "prepends the project name to its parameter"
+ (spy-on 'projectile-project-name :and-return-value "project")
+ (expect (projectile-prepend-project-name "Test") :to-equal "[project] Test")))
+
+(describe "projectile-expand-root"
+ (it "expands a relative path into an absolute path within a project"
+ (spy-on 'projectile-project-root :and-return-value "/path/to/project")
+ (expect (projectile-expand-root "foo") :to-equal "/path/to/project/foo")
+ (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")))