Skip to content

Commit e5aa9d6

Browse files
committed
Test run command
1 parent 4e369b4 commit e5aa9d6

File tree

4 files changed

+114
-0
lines changed

4 files changed

+114
-0
lines changed

test/exit-status/run/Eask

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(package "check-clean" "0.0.1" "mock package")
2+
3+
(package-file "lint.el")
4+
5+
(source 'gnu)
6+
7+
(eask-defcommand my-command
8+
"This is a command"
9+
(message "hello world"))
10+
11+
(eask-defcommand my-warn
12+
(warn "A warning"))
13+
14+
(eask-defcommand my-error
15+
(error "An error"))
16+
17+
(script "hello" "echo 'hello'")
18+
(script "warn" "eask" "run" "command" "my-warn")
19+
(script "exit" "exit" "1")

test/exit-status/run/lint.el

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
;;; lint.el --- Test the command package -*- 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+
(provide 'lint)
27+
28+
;;; lint.el ends here

test/exit-status/run/no-scripts/Eask

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(package "check-clean" "0.0.1" "mock package")
2+
3+
(package-file "lint.el")
4+
5+
(source 'gnu)
6+
7+
(eask-defcommand my-command
8+
"This is a command"
9+
(message "hello world"))
10+
11+
(eask-defcommand my-warn
12+
(warn "A warning"))
13+
14+
(eask-defcommand my-error
15+
(error "An error"))

test/exit-status/run/run.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
# Tests "run" command
21+
22+
set -e
23+
24+
source ./test/fixtures/home/scripts/testing.sh
25+
cd $(dirname "$0")
26+
27+
should_error eask run
28+
# FIXME
29+
# should_error eask run command
30+
# FIXME
31+
# cd ./no-scripts/
32+
# should_error eask run script
33+
# cd ../
34+
35+
should_run eask run command my-command my-warn
36+
# FIXME
37+
# should_error eask run command --strict my-command my-warn
38+
39+
# FIXME stack trace
40+
should_error eask run command my-error
41+
42+
OUTPUT="$(should_error eask run command --allow-error my-error my-command)"
43+
# FIXME
44+
# should_match "hello world" "$OUTPUT"
45+
46+
should_run eask run script hello
47+
should_run eask run script hello foo
48+
# FIXME
49+
# should_error eask run script --strict hello foo
50+
51+
# FIXME this doesn't actually run the script
52+
should_run eask run script warn

0 commit comments

Comments
 (0)