1
0
mirror of https://github.com/Tarrasch/zsh-autoenv.git synced 2024-11-14 05:00:58 +02:00
zsh-autoenv/tests/cwd.t
Daniel Hahler e68a914487 Change default values: .env => .autoenv.zsh etc
This changes the defaults:
 - AUTOENV_FILE_ENTER:   .env       => .autoenv.zsh
 - AUTOENV_FILE_LEAVE:   .env_leave => .autoenv_leave.zsh

`.env` is usually used only for key-value pairs for environment
settings, e.g. with foreman.  We do not want to interfere with this.

This also renames the setting/variable AUTOENV_ENV_FILENAME to
AUTOENV_AUTH_FILE, and uses the [XDG
spec](http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables)
for the default location.

The new default location for the auth file will be
~/.local/share/autoenv_auth.

When the old setting is used, or the previous default exists, a warning
is given with instructions.

Fixes https://github.com/Tarrasch/zsh-autoenv/issues/31.
Closes https://github.com/Tarrasch/zsh-autoenv/pull/32.
2015-05-22 17:20:06 +02:00

41 lines
1.2 KiB
Perl

Test $PWD, $autoenv_event, $autoenv_from_dir and $autoenv_to_dir.
$ source $TESTDIR/setup.zsh || return 1
Setup env actions / output.
$ AUTOENV_LOOK_UPWARDS=1
$ mkdir -p sub/sub2
$ cd sub
$ echo 'echo ENTERED: PWD:${PWD:t} pwd:${${"$(pwd)"}:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t} event:${autoenv_event}' > .autoenv.zsh
$ echo 'echo LEFT: PWD:${PWD:t} pwd:${${"$(pwd)"}:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t} event:${autoenv_event}' > .autoenv_leave.zsh
Manually create auth files.
$ test_autoenv_auth_env_files
The actual tests.
$ cd .
ENTERED: PWD:sub pwd:sub from:sub to:sub event:enter
$ cd ..
LEFT: PWD:cwd.t pwd:cwd.t from:sub to:cwd.t event:leave
$ cd sub/sub2
ENTERED: PWD:sub2 pwd:sub2 from:cwd.t to:sub2 event:enter
Check that symlinked dirs get handled correctly.
$ cd ../..
LEFT: PWD:cwd.t pwd:cwd.t from:sub2 to:cwd.t event:leave
$ ln -s sub sub_linked
$ cd sub_linked
ENTERED: PWD:sub_linked pwd:sub_linked from:cwd.t to:sub_linked event:enter
$ cd sub2
$ cd ../..
LEFT: PWD:cwd.t pwd:cwd.t from:sub2 to:cwd.t event:leave
$ cd sub_linked/sub2
ENTERED: PWD:sub2 pwd:sub2 from:cwd.t to:sub2 event:enter