Skip to content

Commit ab94634

Browse files
committed
Scaffold ert and ecukes tests
1 parent 64a3a5a commit ab94634

File tree

7 files changed

+133
-0
lines changed

7 files changed

+133
-0
lines changed

.ert-runner

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-L .

Cask

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
(depends-on "ecukes")
99
(depends-on "ert-runner")
1010
(depends-on "el-mock")
11+
(depends-on "undercover")
1112
(depends-on "cask-package-toolset"))

features/emacs-fireplace.feature

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Feature: Do Some things
2+
In order to do something
3+
As a user
4+
I want to do something
5+
6+
Scenario: Do Something
7+
Given I have "something"
8+
When I have "something"
9+
Then I should have "something"
10+
And I should have "something"
11+
But I should not have "something"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
;; This file contains your project specific step definitions. All
2+
;; files in this directory whose names end with "-steps.el" will be
3+
;; loaded automatically by Ecukes.
4+
5+
(Given "^I have \"\\(.+\\)\"$"
6+
(lambda (something)
7+
;; ...
8+
))
9+
10+
(When "^I have \"\\(.+\\)\"$"
11+
(lambda (something)
12+
;; ...
13+
))
14+
15+
(Then "^I should have \"\\(.+\\)\"$"
16+
(lambda (something)
17+
;; ...
18+
))
19+
20+
(And "^I have \"\\(.+\\)\"$"
21+
(lambda (something)
22+
;; ...
23+
))
24+
25+
(But "^I should not have \"\\(.+\\)\"$"
26+
(lambda (something)
27+
;; ...
28+
))

features/support/env.el

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(require 'f)
2+
3+
(defvar emacs-fireplace-support-path
4+
(f-dirname load-file-name))
5+
6+
(defvar emacs-fireplace-features-path
7+
(f-parent emacs-fireplace-support-path))
8+
9+
(defvar emacs-fireplace-root-path
10+
(f-parent emacs-fireplace-features-path))
11+
12+
(add-to-list 'load-path emacs-fireplace-root-path)
13+
14+
(require 'undercover)
15+
(undercover "*.el"
16+
(:exclude "*-test.el")
17+
(:report-file "/tmp/undercover-report.json"))
18+
(require 'emacs-fireplace)
19+
(require 'espuds)
20+
(require 'ert)
21+
22+
(Setup
23+
;; Before anything has run
24+
)
25+
26+
(Before
27+
;; Before each scenario is run
28+
)
29+
30+
(After
31+
;; After each scenario is run
32+
)
33+
34+
(Teardown
35+
;; After when everything has been run
36+
)

test/emacs-fireplace-test.el

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
;;; Test for `emacs-fireplace'
2+
3+
;;; Commentary:
4+
;; These are the tests for `emacs-fireplace'
5+
6+
;;; Code:
7+
8+
(ert-deftest emacs-fireplace-should-not-pass ()
9+
(should-not nil))
10+

test/test-helper.el

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
;;; test-helper --- Test helper for emacs-fireplace
2+
3+
;;; Commentary:
4+
;; test helper inspired from https://github.com/tonini/overseer.el/blob/master/test/test-helper.el
5+
6+
;;; Code:
7+
8+
(require 'f)
9+
10+
(defvar cpt-path
11+
(f-parent (f-this-file)))
12+
13+
(defvar emacs-fireplace-test-path
14+
(f-dirname (f-this-file)))
15+
16+
(defvar emacs-fireplace-root-path
17+
(f-parent emacs-fireplace-test-path))
18+
19+
(defvar emacs-fireplace-sandbox-path
20+
(f-expand "sandbox" emacs-fireplace-test-path))
21+
22+
(when (f-exists? emacs-fireplace-sandbox-path)
23+
(error "Something is already in %s. Check and destroy it yourself" emacs-fireplace-sandbox-path))
24+
25+
(defmacro within-sandbox (&rest body)
26+
"Evaluate BODY in an empty sandbox directory."
27+
`(let ((default-directory emacs-fireplace-sandbox-path))
28+
(when (f-exists? emacs-fireplace-sandbox-path)
29+
(f-delete default-directory :force))
30+
(f-mkdir emacs-fireplace-sandbox-path)
31+
,@body
32+
(f-delete default-directory :force)))
33+
34+
(require 'ert)
35+
(require 'el-mock)
36+
(eval-when-compile
37+
(require 'cl))
38+
(require 'undercover)
39+
(undercover "*.el"
40+
(:exclude "*-test.el")
41+
(:send-report nil)
42+
(:report-file "/tmp/undercover-report.json"))
43+
(require 'emacs-fireplace)
44+
45+
(provide 'test-helper)
46+
;;; test-helper.el ends here

0 commit comments

Comments
 (0)