mirror of https://github.com/mattmc3/antidote
Change test setup procedure
This commit is contained in:
parent
fd008b2716
commit
a7d05232ca
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/zsh
|
||||
() {
|
||||
emulate -L zsh
|
||||
setopt local_options
|
||||
|
||||
0=${(%):-%x}
|
||||
local projdir="${0:A:h:h}"
|
||||
local testdir="${projdir}/tests"
|
||||
|
||||
# setup test functions
|
||||
fpath+=( $testdir/functions )
|
||||
autoload -Uz $testdir/functions/*
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
# autoload test functions
|
||||
0=${(%):-%N}
|
||||
autoload -U ${0:A:h}/functions/t_setup
|
||||
t_setup
|
||||
|
|
@ -4,8 +4,9 @@
|
|||
setopt local_options extended_glob glob_dots
|
||||
|
||||
0=${(%):-%x}
|
||||
local prjdir="${0:A:h:h:h}"
|
||||
local testdir="${0:A:h:h}"
|
||||
typeset -g T_PRJDIR="${0:A:h:h:h}"
|
||||
typeset -g T_TESTDATA=$T_PRJDIR/tests/testdata
|
||||
local testdir="$T_PRJDIR/tests"
|
||||
|
||||
# save path/fpath
|
||||
typeset -ga T_PREV_PATH=( $path )
|
||||
|
|
@ -36,6 +37,9 @@
|
|||
cp -rf $p $T_TEMPDIR
|
||||
done
|
||||
|
||||
# put testdata into position
|
||||
cp -rf -- $T_PRJDIR/tests $T_TEMPDIR/tests
|
||||
|
||||
# rename .mockgit to .git
|
||||
local mockdir
|
||||
for mockdir in $T_TEMPDIR/**/.mock*; do
|
||||
|
|
@ -51,4 +55,11 @@
|
|||
zstyle ':antidote:tests' cloning 'off'
|
||||
zstyle ':antidote:bundle' use-friendly-names on
|
||||
zstyle ':antidote:defer' bundle 'getantidote/zsh-defer'
|
||||
|
||||
# start from tmp home
|
||||
pushd
|
||||
cd $T_TEMPDIR
|
||||
|
||||
# source antidote
|
||||
source $T_PRJDIR/antidote.zsh
|
||||
#}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,14 @@
|
|||
#!/bin/zsh
|
||||
#function t_setup_real {
|
||||
0=${(%):-%x}
|
||||
local testdir="${0:A:h:h}"
|
||||
local prjdir="${0:A:h:h:h}"
|
||||
|
||||
# Setup for regular tests
|
||||
t_setup
|
||||
|
||||
# Now undo some of the testing bits to run for real
|
||||
typeset -g T_PRJDIR="${0:A:h:h:h}"
|
||||
typeset -g T_TESTDATA=$T_PRJDIR/tests/testdata/real
|
||||
local testdir="$T_PRJDIR/tests"
|
||||
|
||||
# undo setup so we clone for real
|
||||
zstyle ':antidote:tests' cloning 'on'
|
||||
|
|
@ -14,11 +20,9 @@
|
|||
# unset rupa/z
|
||||
(( $+aliases[z] )) && unalias z
|
||||
|
||||
# replace .zsh_plugins.txt with real versions
|
||||
local file
|
||||
# replace test versions of bundle files with real versions
|
||||
for file in .zsh_plugins.txt .zsh_plugins.zsh; do
|
||||
[[ -f $ZDOTDIR/$file ]] && command rm -f -- "$ZDOTDIR/$file"
|
||||
[[ -f $testdir/real/$file ]] && command rm -f -- "$testdir/real/$file"
|
||||
[[ -f $T_TESTDATA/$file ]] && command cp -f -- "$T_TESTDATA/$file" "$ZDOTDIR/$file"
|
||||
done
|
||||
|
||||
# clean out antidote home
|
||||
|
|
@ -26,5 +30,5 @@
|
|||
mkdir -p "$ANTIDOTE_HOME"
|
||||
|
||||
# source antidote
|
||||
source $prjdir/antidote.zsh
|
||||
# source $T_PRJDIR/antidote.zsh
|
||||
#}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
emulate -L zsh
|
||||
setopt local_options
|
||||
|
||||
# Return to project directory
|
||||
popd
|
||||
|
||||
# reset current session
|
||||
HOME=$T_PREV_HOME
|
||||
ZDOTDIR=$T_PREV_ZDOTDIR
|
||||
|
|
|
|||
Loading…
Reference in New Issue