Change how unit tests are set up and run

Moves init.test.el to core/test/init.el and initializes the test
environment from within the current session, rather than through a bash
script middle man.

TODO: don't buffer the unit test results
This commit is contained in:
Henrik Lissner 2019-08-27 00:06:46 -04:00
parent af26a14230
commit aad0b2f842
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 74 additions and 110 deletions

View file

@ -7,7 +7,6 @@
":"; [ "$1" = -d ] || [ "$1" = --debug ] && { shift; export DEBUG=1; }
":"; [ "$1" = doc ] || [ "$1" = doctor ] && { cd "$DOOMBASE"; shift; exec $EMACS --script bin/doom-doctor "$@"; exit 0; }
":"; [ "$1" = run ] && { cd "$DOOMBASE"; shift; exec $EMACS -q --no-splash -l bin/doom "$@"; exit 0; }
":"; [ "$1" = test ] && { cd "$DOOMBASE"; shift; exec bin/doom-test "$@"; }
":"; exec $EMACS --script "$0" -- "$@"
":"; exit 0

View file

@ -1,35 +0,0 @@
#!/usr/bin/env bash
# Set up test config
export DOOMDIR=/tmp/doom/
export DOOMLOCALDIR=/tmp/doom/.local/
if [[ ! -d "$DOOMDIR" ]]; then
mkdir -p "$DOOMDIR"
ln -s ~/.emacs.d/init.test.el "$DOOMDIR"/init.el
fi
# Set up testing library
BUTTERCUPLIB="${DOOMLOCALDIR}buttercup"
EMACSBIN="emacs --batch -l ~/.emacs.d/init.el -L $BUTTERCUPLIB -l buttercup"
if [[ ! -d "$BUTTERCUPLIB" ]]; then
git clone https://github.com/jorgenschaefer/emacs-buttercup "$BUTTERCUPLIB"
fi
# Run the tests
if [[ ! -f $DOOMLOCALDIR/init || $1 == "-f" ]]; then
doom -y refresh
echo 1 > $DOOMLOCALDIR/init
fi
echo
echo
error=
args=( $@ )
(( $# == 0 )) && args=( core modules/*/* )
for base in $args; do
if [[ -d "$base/test" ]]; then
echo Running $base
$EMACSBIN -f doom-run-tests "$base" || error=1
fi
done
[[ $error ]] && exit 1