Skip to content

Commit 49b1092

Browse files
committed
Tests for testing subcommands
1 parent 794caee commit 49b1092

File tree

18 files changed

+265
-0
lines changed

18 files changed

+265
-0
lines changed

test/exit-status/test/Eask

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(package "lint"
2+
"0.0.1"
3+
"Test project for lint")
4+
(package-file "lint-pkg.el")
5+
6+
(source 'gnu)
7+
(source 'melpa)

test/exit-status/test/activate/Eask

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(package "test-activate"
2+
"0.0.1"
3+
"Test project for test-activate")
4+
(package-file "test-activate-pkg.el")
5+
6+
(source 'gnu)
7+
(source 'melpa)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
;;; test-activate.el --- Test "activate" -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2022-2024 the Eask authors.
4+
5+
;; This program is free software; you can redistribute it and/or modify
6+
;; it under the terms of the GNU General Public License as published by
7+
;; the Free Software Foundation, either version 3 of the License, or
8+
;; (at your option) any later version.
9+
10+
;; This program is distributed in the hope that it will be useful,
11+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
;; GNU General Public License for more details.
14+
15+
;; You should have received a copy of the GNU General Public License
16+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
18+
;;; Version: 0.0.1
19+
20+
;;; Commentary:
21+
22+
;;; Code:
23+
24+
(declare-function ignore "subr.el" (&rest args))
25+
26+
(eval-after-load
27+
'test-activate
28+
(warn "called on activate"))
29+
30+
(provide 'test-activate)
31+
32+
;;; test-activate.el ends here

test/exit-status/test/buttercup/Eask

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(package "test-buttercup"
2+
"0.0.1"
3+
"Test project for test-buttercup")
4+
(package-file "test-buttercup-pkg.el")
5+
6+
(source 'gnu)
7+
(source 'melpa)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
;;; -*- lexical-binding: t; -*-
2+
(describe "A suite"
3+
(it "contains a spec with an expectation"
4+
(expect t :to-be t)))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
;;; -*- lexical-binding: t; -*-
2+
(describe "A suite"
3+
(it "contains a spec with an expectation"
4+
(expect t :to-be t)))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
;;; -*- lexical-binding: t; -*-
2+
(describe "A failing suite"
3+
(it "contains a spec with a failed expectation"
4+
(expect t :to-be nil)))

test/exit-status/test/ecukes/Eask

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(package "ecukes"
2+
"0.0.1"
3+
"Test project for command `ecukes'")
4+
5+
(package-file "ecukes.el")
6+
7+
(source 'gnu)
8+
(source 'melpa)
9+
10+
(development
11+
(depends-on "ecukes"))
12+
13+
(setq network-security-level 'low) ; see https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-932956432
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Feature: Bad test
2+
3+
Scenario: This fails
4+
Then identical things are different

test/exit-status/test/ecukes/features/foo.feature

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(require 'ert)
2+
(Then "identical things are different"
3+
(lambda () (should (equal 1 2))))

test/exit-status/test/ecukes/features/support/env.el

Whitespace-only changes.

test/exit-status/test/empty/Eask

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(package "empty"
2+
"0.0.1"
3+
"Test project for empty")
4+
(package-file "empty-pkg.el")
5+
6+
(source 'gnu)
7+
(source 'melpa)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
;;; lint-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
2+
;; Generated by the `loaddefs-generate' function.
3+
;; This is about the only thing that causes melpazoid to error
4+
;; Package-Version: (("foo", 12345
5+
6+
;; This file is part of GNU Emacs.
7+
8+
;;; Code:
9+
10+
(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
11+
12+
13+
14+
;;; Generated autoloads from checkdoc-fail.el
15+
16+
(register-definition-prefixes "checkdoc-fail" '("my-foo"))
17+
18+
19+
;;; Generated autoloads from elisp-lint-ok.el
20+
21+
(register-definition-prefixes "elisp-lint-ok" '("elisp-lint-ok-foo"))
22+
23+
24+
;;; End of scraped data
25+
26+
(provide 'lint-autoloads)
27+
28+
;; Local Variables:
29+
;; version-control: never
30+
;; no-byte-compile: t
31+
;; no-update-autoloads: t
32+
;; no-native-compile: t
33+
;; coding: utf-8-emacs-unix
34+
;; End:
35+
36+
;;; lint-autoloads.el ends here
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
;;; ert-test.el --- Test the command ert -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2022-2024 the Eask authors.
4+
5+
;; This program is free software; you can redistribute it and/or modify
6+
;; it under the terms of the GNU General Public License as published by
7+
;; the Free Software Foundation, either version 3 of the License, or
8+
;; (at your option) any later version.
9+
10+
;; This program is distributed in the hope that it will be useful,
11+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
;; GNU General Public License for more details.
14+
15+
;; You should have received a copy of the GNU General Public License
16+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
18+
;;; Commentary:
19+
20+
;; Tests for the command ert
21+
22+
;;; Code:
23+
24+
(defun my-foo (arg)
25+
".make a lot of checkdoc errors
26+
27+
in this " ignore)
28+
29+
;;; declare-ok.el ends here

test/exit-status/test/run.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (C) 2022-2024 the Eask authors.
4+
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation; either version 3, or (at your option)
8+
# any later version.
9+
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
18+
## Commentary:
19+
#
20+
# Test command `test`
21+
#
22+
23+
set -e
24+
25+
source ./test/fixtures/home/scripts/testing.sh
26+
cd $(dirname "$0")
27+
28+
# partial input
29+
should_error eask test
30+
31+
# FIXME
32+
# should_error eask test ert
33+
34+
echo "activate"
35+
echo "----------"
36+
cd ./activate/
37+
should_run eask test activate
38+
# FIXME stack trace when missing file
39+
40+
# can create an error by having (eval-after-load 'something (warn "")) in a file that provides 'something
41+
should_run eask test activate test-activate.el
42+
# FIXME
43+
# should_error eask test activate --strict test-activate.el
44+
cd ..
45+
46+
echo "buttercup"
47+
echo "----------"
48+
should_error eask test buttercup empty # no tests
49+
50+
# seems like buttercup either errors or runs, no warn?
51+
should_error eask test buttercup ./buttercup/
52+
53+
echo "ecukes"
54+
echo "----------"
55+
# FIXME this throws file-missing, emits stack trace
56+
should_error eask test ecukes
57+
58+
cd ./ecukes/
59+
should_run eask test ecukes features/foo.feature
60+
# FIXME expect failing tests to exit with non-zero
61+
# should_error eask test ecukes
62+
cd ..
63+
64+
echo "ert-runner"
65+
echo "----------"
66+
cd empty/
67+
should_error eask test ert-runner
68+
cd ..
69+
70+
# FIXME ert-runner ignores arguments
71+
# should_run eask test ert-runner test/ert-test.el
72+
# should_error eask test ert-runner test/ert-fail-test.el
73+
should_error eask test ert-runner # all tests
74+
75+
echo "ert"
76+
echo "----------"
77+
# FIXME partial input should error
78+
# should_error eask test ert
79+
80+
should_run eask test ert test/ert-test.el
81+
should_error eask test ert test/ert-fail-test.el
82+
should_error eask test ert test/*.el
83+
84+
# --allow-error has no effect
85+
86+
echo "melpazoid"
87+
echo "----------"
88+
# FIXME doesn't error, in fact it hardly seems to error
89+
# should_error eask test --strict melpazoid melpazoid-warn/
90+
91+
# The only time it errors is with a malformed package-version header
92+
should_error eask test melpazoid melpazoid-fail/
93+
94+
should_run eask test melpazoid empty/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(require 'ert)
2+
3+
(ert-deftest my-fail/test ()
4+
"Tests something."
5+
(should (equal 't nil)))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(require 'ert)
2+
3+
(ert-deftest my-something/test ()
4+
"Tests something."
5+
(should (equal 't 't)))
6+
7+
(ert-deftest my-something-2/test ()
8+
"Tests something."
9+
(should-not nil))

0 commit comments

Comments
 (0)