2019-12-28 09:24:56 +00:00
|
|
|
# FIXME why is one saved with trailing "/" , the other not?
|
|
|
|
DEFAULT_NOTES="$HOME/documents/notes/"
|
|
|
|
DEFAULT_LIB="$HOME/documents/library"
|
|
|
|
DEFAULT_BIB="$DEFAULT_LIB/academia/academia.bib"
|
|
|
|
|
2019-07-27 11:42:54 +00:00
|
|
|
setup() {
|
2019-12-28 09:24:56 +00:00
|
|
|
testfile="$BATS_TEST_DIRNAME/../env-vars.sh"
|
2019-07-27 11:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
teardown() {
|
2019-12-28 09:24:56 +00:00
|
|
|
unset WIKIROOT
|
|
|
|
unset LIBRARYROOT
|
|
|
|
unset BIBFILE
|
2019-07-27 11:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "Populates WIKIROOT environment variable" {
|
|
|
|
source $testfile
|
|
|
|
[ -n "$WIKIROOT" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "Sets WIKIROOT to correct default path" {
|
|
|
|
source $testfile
|
2019-12-28 09:24:56 +00:00
|
|
|
echo $WIKIROOT
|
|
|
|
[ "$WIKIROOT" = "$DEFAULT_NOTES" ]
|
2019-07-27 11:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "Leaves WIKIROOT as is if it is already set" {
|
|
|
|
export WIKIROOT="MY/CUSTOM/DIR"
|
|
|
|
source $testfile
|
|
|
|
[ "$WIKIROOT" = "MY/CUSTOM/DIR" ]
|
|
|
|
}
|
2019-12-28 09:24:56 +00:00
|
|
|
|
|
|
|
@test "Populates LIBRARYROOT environment variable" {
|
|
|
|
source $testfile
|
|
|
|
[ -n "$LIBRARYROOT" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "Sets LIBRARYROOT to correct default path" {
|
|
|
|
source $testfile
|
|
|
|
echo $LIBRARYROOT
|
|
|
|
[ "$LIBRARYROOT" = "$DEFAULT_LIB" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "Leaves LIBRARYROOT as is if it is already set" {
|
|
|
|
export LIBRARYROOT="MY/CUSTOM/DIR"
|
|
|
|
source $testfile
|
|
|
|
[ "$LIBRARYROOT" = "MY/CUSTOM/DIR" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "Populates BIBFILE environment variable" {
|
|
|
|
source $testfile
|
|
|
|
[ -n "$BIBFILE" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "Sets BIBFILE to correct default path" {
|
|
|
|
source $testfile
|
|
|
|
echo $BIBFILE
|
|
|
|
[ "$BIBFILE" = "$DEFAULT_BIB" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "Leaves BIBFILE as is if it is already set" {
|
|
|
|
export BIBFILE="MY/CUSTOM/DIR"
|
|
|
|
source $testfile
|
|
|
|
[ "$BIBFILE" = "MY/CUSTOM/DIR" ]
|
|
|
|
}
|