aboutsummaryrefslogtreecommitdiff
path: root/ci/test.sh
diff options
context:
space:
mode:
authorErik Martin-Dorel2020-04-16 18:02:43 +0200
committerErik Martin-Dorel2020-04-17 08:23:04 +0200
commit76943f911134863596eb5ca150f7b9c8051eac72 (patch)
tree4c1c95b1beb2733a81a86e9669b18b2f7de7b9dd /ci/test.sh
parent234d9761212b3e70d538de9704a6bcd29ea684c8 (diff)
chore: Add shell script to automate the tests
* Inspired by https://github.com/pfitaxel/learn-ocaml.el/blob/master/test.sh (under license MIT)
Diffstat (limited to 'ci/test.sh')
-rwxr-xr-xci/test.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/ci/test.sh b/ci/test.sh
new file mode 100755
index 00000000..e9e0b472
--- /dev/null
+++ b/ci/test.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Print $1 in green
+green () {
+ echo -e "\e[32m$1\e[0m"
+}
+
+# Print $1 in red
+red () {
+ echo -e "\e[31m$1\e[0m"
+}
+
+assert () {
+ if [ $# -lt 1 ]; then
+ red "ERROR, assert expects some args (the code to run)"
+ exit 1
+ fi
+ /bin/bash -exc '"$@"' bash "$@"
+ ret=$?
+ if [ "$ret" -ne 0 ]; then
+ red "FAILURE, this shell command returned exit status $ret:
+\$ $(printf "'%s' " "$@")\n"
+ exit $ret
+ fi
+ echo
+}
+
+###############################################################################
+
+assert emacs --version
+
+srcdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && cd .. && pwd )
+rootdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )
+
+# form="(message \"OK\")"
+form="(progn (add-to-list 'load-path \"$rootdir\") (add-to-list 'load-path \"$srcdir\"))"
+
+assert emacs --batch -l ert -l init-tests.el --eval "$form" -l proof-general.el -f ert-run-tests-batch-and-exit