Skip to content

Commit 4144d93

Browse files
committed
Merge pull request #52 from elixir-lang/tests-cli
Add CLI for running elixir-mode tests.
2 parents 0eb9724 + 8d00fcf commit 4144d93

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

ert-bootstrap.el

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
;; Add the current directory to load path.
2+
(add-to-list 'load-path (file-name-directory
3+
(or load-file-name buffer-file-name)))
4+
;; The test fixtures assume an indentation width of 2, so we need to set that
5+
;; up for the tests.
6+
(setq-default default-tab-width 2)
7+
(setq-default indent-tabs-mode nil)
8+
(require 'elixir-mode)

run_tests

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# -*- shell-script -*-
3+
OUTPUT=/tmp/test-output.txt
4+
emacs -batch -l ert-bootstrap.el -l elixir-mode-tests.el -f ert-run-tests-batch-and-exit 2> $OUTPUT
5+
6+
if [ $? == 0 ]; then
7+
echo "Success -- All tests passed."
8+
rm $OUTPUT
9+
else
10+
# Give the user to re-do the tests in emacs proper
11+
cat /tmp/test-output.txt
12+
while [[ 1 ]]
13+
do
14+
read -p "There were test failures. Re-run in regular Emacs? [Yn]" choice
15+
case $choice in
16+
n|N)
17+
break
18+
;;
19+
*)
20+
emacs -l elixir-mode-tests.el -f elixir-mode-run-tests
21+
;;
22+
esac
23+
done
24+
fi
25+

0 commit comments

Comments
 (0)