diff --git a/ert-bootstrap.el b/ert-bootstrap.el new file mode 100644 index 00000000..72756c20 --- /dev/null +++ b/ert-bootstrap.el @@ -0,0 +1,8 @@ +;; Add the current directory to load path. +(add-to-list 'load-path (file-name-directory + (or load-file-name buffer-file-name))) +;; The test fixtures assume an indentation width of 2, so we need to set that +;; up for the tests. +(setq-default default-tab-width 2) +(setq-default indent-tabs-mode nil) +(require 'elixir-mode) diff --git a/run_tests b/run_tests new file mode 100755 index 00000000..ec699af9 --- /dev/null +++ b/run_tests @@ -0,0 +1,25 @@ +#!/bin/bash +# -*- shell-script -*- +OUTPUT=/tmp/test-output.txt +emacs -batch -l ert-bootstrap.el -l elixir-mode-tests.el -f ert-run-tests-batch-and-exit 2> $OUTPUT + +if [ $? == 0 ]; then + echo "Success -- All tests passed." + rm $OUTPUT +else + # Give the user to re-do the tests in emacs proper + cat /tmp/test-output.txt + while [[ 1 ]] + do + read -p "There were test failures. Re-run in regular Emacs? [Yn]" choice + case $choice in + n|N) + break + ;; + *) + emacs -l elixir-mode-tests.el -f elixir-mode-run-tests + ;; + esac + done +fi +