File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,8 +32,10 @@ setup_fixture() {
3232 " ${ROOT} /deep/a/b/proj/.git"
3333}
3434
35+ TEST_HOME=" "
3536cleanup () {
3637 [[ -n " ${ROOT} " ]] && rm -rf " ${ROOT} " " ${XDG_CACHE_HOME} "
38+ [[ -n " ${TEST_HOME} " ]] && rm -rf " ${TEST_HOME} "
3739}
3840trap cleanup EXIT
3941
@@ -114,8 +116,14 @@ main() {
114116 setup_fixture
115117 local dotfiles
116118 dotfiles=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd) "
119+ # shell/aliases sources "${HOME}/.dotfiles/shell/os.sh", so point HOME at a
120+ # temp dir whose .dotfiles symlinks to this repo. That lets the test run
121+ # from any checkout path, not only ~/.dotfiles.
122+ TEST_HOME=" $( mktemp -d " ${TMPDIR:-/ tmp} /project_open_home.XXXXXX" ) "
123+ ln -s " ${dotfiles} " " ${TEST_HOME} /.dotfiles"
124+ export HOME=" ${TEST_HOME} "
117125 # shellcheck source=/dev/null
118- source " ${dotfiles} /shell/aliases"
126+ source " ${HOME} /.dotfiles /shell/aliases"
119127
120128 test_scan
121129 test_cache
You can’t perform that action at this time.
0 commit comments