From 52b486bca806b4b25830a1cffd5a462b6025fa29 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Mon, 17 Oct 2016 13:50:06 +0100 Subject: [PATCH] Setup urchin tests with test for loading --- .gitignore | 1 + tests/common.sh | 11 +++++++++++ tests/loading/Check zsh-nvm is loaded | 10 ++++++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/common.sh create mode 100755 tests/loading/Check zsh-nvm is loaded diff --git a/.gitignore b/.gitignore index 490dc76..49b3b8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +tests/.urchin.log previous_version diff --git a/tests/common.sh b/tests/common.sh new file mode 100644 index 0000000..70c8f73 --- /dev/null +++ b/tests/common.sh @@ -0,0 +1,11 @@ +export test_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +export repo_dir="$test_dir/.." + +die () { + echo $@ + exit 1 +} + +load_zsh_nvm() { + source "$repo_dir/zsh-nvm.plugin.zsh" +} diff --git a/tests/loading/Check zsh-nvm is loaded b/tests/loading/Check zsh-nvm is loaded new file mode 100755 index 0000000..fa391d4 --- /dev/null +++ b/tests/loading/Check zsh-nvm is loaded @@ -0,0 +1,10 @@ +source ../common.sh + +# Check ZSH_NVM_DIR isn't already set +[[ -z ${ZSH_NVM_DIR+x} ]] || die "ZSH_NVM_DIR already set" + +# Load zsh-nvm +load_zsh_nvm + +# Check ZSH_NVM_DIR is now set +[[ ! -z ${ZSH_NVM_DIR+x} ]] || die "ZSH_NVM_DIR wasn't set"