]> Sergey Matveev's repositories - zsh-autoenv.git/commitdiff
Removed unused files
authorSergey Matveev <stargrave@stargrave.org>
Fri, 14 May 2021 09:47:27 +0000 (12:47 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 15 May 2021 11:42:04 +0000 (14:42 +0300)
25 files changed:
.gitignore [deleted file]
.travis.yml [deleted file]
Makefile [deleted file]
README.md [deleted file]
autoenv.plugin.zsh [deleted file]
init.zsh [deleted file]
tests/ZDOTDIR.invalid-module_path/.zshenv [deleted file]
tests/ZDOTDIR.loadviafunction/.zshenv [deleted file]
tests/ZDOTDIR.options/.zshenv [deleted file]
tests/_autoenv_stack.t [deleted file]
tests/_autoenv_utils.t [deleted file]
tests/autoenv-edit.t [deleted file]
tests/autoenv.t [deleted file]
tests/autoenv_utils.t [deleted file]
tests/cwd.t [deleted file]
tests/leave.t [deleted file]
tests/recurse-upwards.t [deleted file]
tests/setup.zsh [deleted file]
tests/source-parent-until.t [deleted file]
tests/source-parent-vars.t [deleted file]
tests/upgrade_hash.t [deleted file]
tests/varstash-alias.t [deleted file]
tests/varstash-unstash-on-leave.t [deleted file]
tests/varstash.t [deleted file]
tests/varstash_export.t [deleted file]

diff --git a/.gitignore b/.gitignore
deleted file mode 100644 (file)
index 1700a56..0000000
+++ /dev/null
@@ -1 +0,0 @@
-tests/*.err
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index c609fdc..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-language: generic
-sudo: false
-env:
-  - ZSH=4
-  - ZSH=5
-
-install:
-  - if [ "$ZSH" = 4 ]; then sudo apt-get install zsh; fi
-  - if [ "$ZSH" = 5 ]; then wget http://downloads.sourceforge.net/project/zsh/zsh/5.0.7/zsh-5.0.7.tar.bz2; tar xf zsh-5.0.7.tar.bz2; cd zsh-5.0.7; ./configure && sudo make && sudo make install; cd ..; fi
-  - pip install --user cram
-script:
-  - zsh --version
-  - make test_full
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 4b6c77e..0000000
--- a/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-# Empty by default, can be overridden using "make test ZDOTDIR=…".
-ZDOTDIR:=
-# Make it absolute.
-override ZDOTDIR:=$(abspath $(ZDOTDIR))
-
-TEST_SHELL:=zsh
-
-test:
-       ZDOTDIR=$(ZDOTDIR) cram --shell=$(TEST_SHELL) -v tests
-
-itest:
-       ZDOTDIR=$(ZDOTDIR) cram -i --shell=$(TEST_SHELL) tests
-
-# Run tests with all ZDOTDIRs.
-test_full:
-       @ret=0; \
-       for i in $(wildcard tests/ZDOTDIR*); do \
-         echo "TEST_SHELL=$(TEST_SHELL) ZDOTDIR=$$i"; \
-         ZDOTDIR=${CURDIR}/$$i cram --shell=$(TEST_SHELL) -v tests || ret=$$?; \
-         echo; \
-       done; \
-       exit $$ret
-
-# Define targets for test files, with relative and abolute path.
-# Use verbose output, which is useful with Vim's 'errorformat'.
-TESTS:=$(wildcard tests/*.t)
-
-uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
-_TESTS_REL_AND_ABS:=$(call uniq,$(abspath $(TESTS)) $(TESTS))
-$(_TESTS_REL_AND_ABS):
-       cram --shell=$(TEST_SHELL) -v $@
-.PHONY: $(_TESTS_REL_AND_ABS)
-
-.PHONY: itest test
-
-clean:
-       $(RM) tests/*.err
diff --git a/README.md b/README.md
deleted file mode 100644 (file)
index c0036ce..0000000
--- a/README.md
+++ /dev/null
@@ -1,251 +0,0 @@
-[![Build Status](https://travis-ci.org/Tarrasch/zsh-autoenv.svg?branch=master)](https://travis-ci.org/Tarrasch/zsh-autoenv)
-
-# Autoenv for Zsh
-
-zsh-autoenv automatically sources (known/whitelisted) `.autoenv.zsh` files,
-typically used in project root directories.
-
-It handles "enter" and leave" events, nesting, and stashing of
-variables (overwriting and restoring).
-
-## Requirements
-
-- Zsh version 4.3.10 or later.
-
-## Features
-
-- Support for enter and leave events, which can use the same file.
-  By default it uses `.autoenv.zsh` for entering, and `.autoenv_leave.zsh`
-  for leaving.
-- Interactively asks for confirmation / authentication before sourcing an
-  unknown `.autoenv.zsh` file, and remembers whitelisted files by their
-  hashed content.
-- Test suite.
-- Written in/for Zsh.
-
-### Variable stashing
-
-You can use `autostash` in your `.autoenv.zsh` files to overwrite some
-variable, e.g.  `$PATH`.  When leaving the directory, it will be automatically
-restored.
-
-    % echo 'echo ENTERED; autostash FOO=changed' > project/.autoenv.zsh
-    % FOO=orig
-    % cd project
-    Attempting to load unauthorized env file!
-    -rw-rw-r-- 1 user user 36 Mai  6 20:38 /tmp/project/.autoenv.zsh
-
-    **********************************************
-
-    echo ENTERED; autostash FOO=changed
-
-    **********************************************
-
-    Would you like to authorize it? (type 'yes') yes
-    ENTERED
-    project % echo $FOO
-    changed
-    % cd ..
-    % echo $FOO
-    orig
-
-There is also `stash`, `unstash` and `autounstash`, in case you want to
-have more control.
-
-The varstash library has been taken from smartcd, and was optimized for Zsh.
-
-## Writing your .autoenv.zsh file
-
-### `autoenv_source_parent()`
-
-zsh-autoenv will stop looking for `.autoenv.zsh` files upwards after the first
-one has been found, but you can use the function `autoenv_source_parent` to
-source the next `.autoenv.zsh` file upwards the directory tree from there.
-
-The function accepts an optional argument, which allows to stop looking before
-the file system root is reached:
-
-```zsh
-autoenv_source_parent ../..
-```
-
-## Installation
-
-Clone the repository and source it from your `~/.zshrc` file:
-
-    % git clone https://github.com/Tarrasch/zsh-autoenv ~/.dotfiles/lib/zsh-autoenv
-    % echo 'source ~/.dotfiles/lib/zsh-autoenv/autoenv.zsh' >> ~/.zshrc
-
-### Using [antigen](https://github.com/zsh-users/antigen)
-
-    antigen-bundle Tarrasch/zsh-autoenv
-
-### Using [zgen](https://github.com/tarjoilija/zgen)
-
-Add the following to your `.zshrc` where you are loading your plugins:
-
-    zgen load Tarrasch/zsh-autoenv
-
-### Using [zplug](https://github.com/zplug/zplug)
-
-Add the following to your `.zshrc` where you are loading your plugins:
-
-    zplug "Tarrasch/zsh-autoenv"
-
-## Configuration
-
-You can use the following variables to control zsh-autoenv's behavior.
-Add them to your `~/.zshrc` file, before sourcing/loading zsh-autoenv.
-
-### AUTOENV_FILE_ENTER
-
-Name of the file to look for when entering directories.
-
-Default: `.autoenv.zsh`
-
-### AUTOENV_FILE_LEAVE
-
-Name of the file to look for when leaving directories.
-Requires `AUTOENV_HANDLE_LEAVE=1`.
-
-Default: `.autoenv_leave.zsh`
-
-### AUTOENV_LOOK_UPWARDS
-
-Look for zsh-autoenv "enter" files in parent dirs?
-
-Default: `1`
-
-### AUTOENV_HANDLE_LEAVE
-
-Handle leave events when changing away from a subtree, where an "enter"
-event was handled?
-
-Default: `1`
-
-### AUTOENV_DISABLED
-
-(Temporarily) disable zsh-autoenv. This gets looked at in the chpwd handler.
-
-Default: 0
-
-### AUTOENV_DEBUG
-
-Set debug level. If enabled (> 0) it will print information to stderr.
-
-- 0: no debug messages
-- 1: generic debug logging
-- 2: more verbose messages
-  - messages about adding/removing files on the internal stack
-- 3: everything
-  - sets xtrace option (`set -x`) while sourcing env files
-
-Default: `0`
-
-## Usage
-
-zsh-autoenv works automatically once installed.
-
-You can use ``autoenv-edit`` to edit the nearest/current autoenv files.
-It will use ``$AUTOENV_EDITOR``, ``$EDITOR``, or ``vim`` for editing.
-
-## Helper functions
-
-The following helper functions are available:
-
-### autoenv_append_path
-
-Appends path(s) to `$path` (`$PATH`), if they are not in there already.
-
-### autoenv_prepend_path
-
-Prepends path(s) to `$path` (`$PATH`), if they are not in there already.
-
-### autoenv_remove_path
-
-Removes path(s) from `$path` (`$PATH`).
-
-Returns 0 in case `$path` has changed, 1 otherwise.
-
-## Recipes
-
-### Automatically activate Python virtualenvs
-
-Given `AUTOENV_FILE_ENTER=.autoenv.zsh`, `AUTOENV_FILE_LEAVE=.autoenv.zsh` and
-`AUTOENV_HANDLE_LEAVE=1` the following script will activate Python virtualenvs
-automatically in all subdirectories (`.venv` directories get used by
-[pipenv](https://github.com/kennethreitz/pipenv) with
-`PIPENV_VENV_IN_PROJECT=1`):
-
-```zsh
-# Environment file for all projects.
-#  - (de)activates Python virtualenvs (.venv) from pipenv
-
-if [[ $autoenv_event == 'enter' ]]; then
-  autoenv_source_parent
-
-  _my_autoenv_venv_chpwd() {
-    if [[ -z "$_ZSH_ACTIVATED_VIRTUALENV" && -n "$VIRTUAL_ENV" ]]; then
-      return
-    fi
-
-    setopt localoptions extendedglob
-    local -a venv
-    venv=(./(../)#.venv(NY1:A))
-
-    if [[ -n "$_ZSH_ACTIVATED_VIRTUALENV" && -n "$VIRTUAL_ENV" ]]; then
-      if ! (( $#venv )) || [[ "$_ZSH_ACTIVATED_VIRTUALENV" != "$venv[1]" ]]; then
-        unset _ZSH_ACTIVATED_VIRTUALENV
-        echo "De-activating virtualenv: ${(D)VIRTUAL_ENV}" >&2
-
-        # Simulate "deactivate", but handle $PATH better (remove VIRTUAL_ENV).
-        if ! autoenv_remove_path $VIRTUAL_ENV/bin; then
-          echo "warning: ${VIRTUAL_ENV}/bin not found in \$PATH" >&2
-        fi
-
-        # NOTE: does not handle PYTHONHOME/_OLD_VIRTUAL_PYTHONHOME
-        unset _OLD_VIRTUAL_PYTHONHOME
-        # NOTE: does not handle PS1/_OLD_VIRTUAL_PS1
-        unset _OLD_VIRTUAL_PS1
-        unset VIRTUAL_ENV
-      fi
-    fi
-
-    if [[ -z "$VIRTUAL_ENV" ]]; then
-      if (( $#venv )); then
-        echo "Activating virtualenv: ${(D)venv}" >&2
-        export VIRTUAL_ENV=$venv[1]
-        autoenv_prepend_path $VIRTUAL_ENV/bin
-        _ZSH_ACTIVATED_VIRTUALENV="$venv[1]"
-      fi
-    fi
-  }
-  autoload -U add-zsh-hook
-  add-zsh-hook chpwd _my_autoenv_venv_chpwd
-  _my_autoenv_venv_chpwd
-else
-  add-zsh-hook -d chpwd _my_autoenv_venv_chpwd
-fi
-```
-
-## Related projects
-
-- <https://github.com/direnv/direnv>
-- <https://github.com/cxreg/smartcd>
-- <https://github.com/kennethreitz/autoenv>
-
-## History
-
-This started as an optimized version of the bash plugin
-[autoenv](https://github.com/kennethreitz/autoenv) but for Zsh, and grew a lot
-of functionality on top of it (inspired by [smartcd]).
-
-The code was initially based on
-[@joshuaclayton](https://github.com/joshuaclayton)'s dotfiles.
-In September 2013 [@Tarrasch](https://github.com/Tarrasch) packaged it into a
-nice [antigen]-compatible unit with integration tests. Since November 2014,
-[@blueyed](https://github.com/blueyed) took over and added many nice
-features, mainly inspired by [smartcd].
-
-[antigen]: https://github.com/Tarrasch/antigen-hs
-[smartcd]: https://github.com/cxreg/smartcd
diff --git a/autoenv.plugin.zsh b/autoenv.plugin.zsh
deleted file mode 100644 (file)
index 3b48f9b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-. ${0:h}/autoenv.zsh
diff --git a/init.zsh b/init.zsh
deleted file mode 100644 (file)
index b6aca49..0000000
--- a/init.zsh
+++ /dev/null
@@ -1 +0,0 @@
-. $(dirname $0)/autoenv.zsh
diff --git a/tests/ZDOTDIR.invalid-module_path/.zshenv b/tests/ZDOTDIR.invalid-module_path/.zshenv
deleted file mode 100644 (file)
index ec3e341..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Use invalid module path for zsh, to test alternative zstat implementation.
-
-# Pre-load zsh/parameter, where we do not have/need(?) an alternative
-# implementation.
-zmodload zsh/parameter
-
-module_path=(/dev/null)
-
-zstat() {
-  echo "Should not get called."
-}
diff --git a/tests/ZDOTDIR.loadviafunction/.zshenv b/tests/ZDOTDIR.loadviafunction/.zshenv
deleted file mode 100644 (file)
index 7282797..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-antigen-like-loader-function() {
-  source "$TESTDIR/../autoenv.plugin.zsh"
-}
-TEST_SOURCE_AUTOENV=antigen-like-loader-function
diff --git a/tests/ZDOTDIR.options/.zshenv b/tests/ZDOTDIR.options/.zshenv
deleted file mode 100644 (file)
index cacdc9b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Set uncommon options that caused problems in the past.
-setopt noclobber
-setopt shwordsplit
diff --git a/tests/_autoenv_stack.t b/tests/_autoenv_stack.t
deleted file mode 100644 (file)
index 580176c..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-Tests for internal stack handling.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Non-existing entries are allowed and handled without error.
-
-  $ _autoenv_stack_entered_add non-existing
-  $ echo $_autoenv_stack_entered
-  non-existing
-
-Add existing entries.
-
-  $ mkdir -p sub/sub2
-  $ touch -t 201401010101 sub/file
-  $ touch -t 201401010102 sub
-  $ touch -t 201401010103 sub/sub2
-  $ _autoenv_stack_entered_add sub
-  $ _autoenv_stack_entered_add sub/file
-  $ _autoenv_stack_entered_add sub/sub2
-  $ echo $_autoenv_stack_entered
-  non-existing sub sub/file sub/sub2
-
-  $ _autoenv_stack_entered_add non-existing
-  $ echo $_autoenv_stack_entered
-  sub sub/file sub/sub2 non-existing
-
-  $ echo ${(k)_autoenv_stack_entered}
-  sub sub/file sub/sub2 non-existing
-
-  $ echo $_autoenv_stack_entered_mtime
-  1388538180 1388538060 1388538120 0
-
-Touch the file and re-add it.
-
-  $ touch -t 201401012359 sub/file
-  $ _autoenv_stack_entered_add sub/file
-
-The mtime should have been updated.
-
-  $ echo ${_autoenv_stack_entered_mtime[sub/file]}
-  1388620740
-
-It should have moved to the end of the stack.
-
-  $ echo ${(k)_autoenv_stack_entered}
-  sub sub/sub2 non-existing sub/file
-
-Test lookup of containing elements.
-
-  $ _autoenv_stack_entered_contains sub/file
-  $ _autoenv_stack_entered_contains non-existing
-  $ _autoenv_stack_entered_contains not-added
-  [1]
-
-Test removing.
-
-  $ _autoenv_stack_entered_remove sub
-  $ echo ${_autoenv_stack_entered}
-  sub/sub2 non-existing sub/file
-
diff --git a/tests/_autoenv_utils.t b/tests/_autoenv_utils.t
deleted file mode 100644 (file)
index 86e93c9..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-Tests for internal util methods.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Non-existing entries are allowed and handled without error.
-
-  $ mkdir -p sub/sub2
-  $ touch file sub/file sub/sub2/file
-
-Should not get the file from the current dir.
-
-  $ _autoenv_get_file_upwards . file
-
-  $ cd sub/sub2
-  $ _autoenv_get_file_upwards . file
-  ../file
-  $ _autoenv_get_file_upwards $PWD file
-  */_autoenv_utils.t/sub/file (glob)
-
-_autoenv_get_file_upwards should not dereference symlinks.
-
-  $ cd ../..
-  $ ln -s sub symlink
-  $ cd symlink/sub2
-  $ _autoenv_get_file_upwards . file
-  ../file
-  $ _autoenv_get_file_upwards $PWD file
-  */_autoenv_utils.t/symlink/file (glob)
-
-Tests for _autoenv_authorize. {{{
-
-Auth file is empty.
-
-  $ cd ../..
-  $ ! [[ -f "$AUTOENV_AUTH_FILE" ]] || cat $AUTOENV_AUTH_FILE
-
-Failed authorization should keep the auth file empty.
-
-  $ _autoenv_authorize does-not-exist
-  Missing file argument for _autoenv_hash_pair!
-  [1]
-  $ cat $AUTOENV_AUTH_FILE
-
-Now adding some auth pair.
-
-  $ echo first > first
-  $ _autoenv_authorize first
-  $ cat $AUTOENV_AUTH_FILE
-  :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
-
-And a second one.
-
-  $ echo second > second
-  $ _autoenv_authorize second
-  $ cat $AUTOENV_AUTH_FILE
-  :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
-  :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
-
-And a third.
-
-  $ echo third > third
-  $ _autoenv_authorize third
-  $ cat $AUTOENV_AUTH_FILE
-  :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
-  :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
-  :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
-
-Re-add the second one, with the same hash.
-
-  $ _autoenv_authorize second
-  $ cat $AUTOENV_AUTH_FILE
-  :/*/cramtests-*/_autoenv_utils.t/first:2715464726.6:2 (glob)
-  :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
-  :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
-
-Re-add the first one, with a new hash.
-
-  $ echo one more line >> first
-  $ _autoenv_authorize first
-  $ cat $AUTOENV_AUTH_FILE
-  :/*/cramtests-*/_autoenv_utils.t/third:451243482.6:2 (glob)
-  :/*/cramtests-*/_autoenv_utils.t/second:594940475.7:2 (glob)
-  :/*/cramtests-*/_autoenv_utils.t/first:3620404822.20:2 (glob)
-}}}
-
-
-Explicit calls to _autoenv_get_file_mtime to test alternative implementation
-of _autoenv_get_file_mtime (via ZDOTDIR.invalid-module_path/).
-
-  $ _autoenv_get_file_mtime non-existing
-  0
-  $ touch -t 201401010101 file
-  $ _autoenv_get_file_mtime file
-  1388538060
-  $ mkdir dir
-  $ touch -t 201401010102 dir
-  $ _autoenv_get_file_mtime dir
-  1388538120
-
-Stops when last (absolute) path does not change anymore.
-
-  $ _autoenv_get_file_upwards / doesnotexist nevermatches
diff --git a/tests/autoenv-edit.t b/tests/autoenv-edit.t
deleted file mode 100644 (file)
index d2bf172..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-  $ source $TESTDIR/setup.zsh || return 1
-
-  $ export EDITOR=echo
-
-  $ autoenv-edit
-  No .autoenv.zsh file found (enter).
-  No .autoenv_leave.zsh file found (leave).
-  [1]
-
-  $ touch .autoenv.zsh
-  $ autoenv-edit
-  No .autoenv_leave.zsh file found (leave).
-  Editing .autoenv.zsh..
-  .autoenv.zsh
-
-  $ AUTOENV_FILE_LEAVE=$AUTOENV_FILE_ENTER
-  $ autoenv-edit
-  Editing .autoenv.zsh..
-  .autoenv.zsh (glob)
-
-  $ mkdir sub
-  $ cd -q sub
-  $ autoenv-edit
-  Editing ../.autoenv.zsh..
-  ../.autoenv.zsh
-
-Supports command with args for EDITOR.
-
-  $ export EDITOR='printf file:%s\\n'
-  $ autoenv-edit
-  Editing ../.autoenv.zsh..
-  file:../.autoenv.zsh
-
-Supports alias for EDITOR.
-
-  $ alias myeditor_alias='printf file:%s'
-  $ export EDITOR=myeditor_alias
-  $ autoenv-edit
-  Editing ../.autoenv.zsh..
-  file:../.autoenv.zsh (no-eol)
-
-Falls back to "vim" for EDITOR.
-
-  $ alias vim='printf vim_file:%s'
-  $ unset EDITOR
-  $ autoenv-edit
-  Editing ../.autoenv.zsh..
-  vim_file:../.autoenv.zsh (no-eol)
-
-Note with AUTOENV_LOOK_UPWARDS=0
-
-  $ EDITOR=true
-  $ AUTOENV_LOOK_UPWARDS=0
-  $ autoenv-edit
-  Note: found ../.autoenv.zsh, but AUTOENV_LOOK_UPWARDS is disabled.
-  Editing ../.autoenv.zsh..
-
-  $ AUTOENV_FILE_LEAVE=.autoenv_leave.zsh
-  $ touch ../$AUTOENV_FILE_LEAVE
-  $ autoenv-edit
-  Note: found ../.autoenv.zsh, but AUTOENV_LOOK_UPWARDS is disabled.
-  Note: found ../.autoenv_leave.zsh, but AUTOENV_LOOK_UPWARDS is disabled.
-  Editing ../.autoenv.zsh ../.autoenv_leave.zsh..
-
-  $ touch $AUTOENV_FILE_LEAVE
-  $ autoenv-edit
-  Note: found ../.autoenv.zsh, but AUTOENV_LOOK_UPWARDS is disabled.
-  Editing ../.autoenv.zsh .autoenv_leave.zsh..
diff --git a/tests/autoenv.t b/tests/autoenv.t
deleted file mode 100644 (file)
index 8d2e864..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-  $ source $TESTDIR/setup.zsh || return 1
-
-Lets set a simple .autoenv.zsh action
-
-  $ echo 'echo ENTERED' > .autoenv.zsh
-
-Manually create auth file
-
-  $ test_autoenv_add_to_env $PWD/.autoenv.zsh
-  $ cd .
-  ENTERED
-
-Now try to make it accept it
-
-  $ _autoenv_stack_entered=()
-  $ rm $AUTOENV_AUTH_FILE
-  $ _autoenv_ask_for_yes() { echo "yes" }
-  $ cd .
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/autoenv.t/.autoenv.zsh (glob)
-  
-  **********************************************
-  
-  echo ENTERED
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') yes
-  ENTERED
-
-
-The last "ENTERED" is because it executed the command.
-
-Now lets see that it actually checks the shasum value.
-
-  $ _autoenv_stack_entered=()
-  $ cd .
-  ENTERED
-
-  $ _autoenv_stack_entered=()
-  $ rm $AUTOENV_AUTH_FILE
-  $ test_autoenv_add_to_env $PWD/.autoenv.zsh mischief
-  $ cd .
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/autoenv.t/.autoenv.zsh (glob)
-  
-  **********************************************
-  
-  echo ENTERED
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') yes
-  ENTERED
-
-
-Now, will it take no for an answer?
-
-  $ _autoenv_stack_entered=()
-  $ rm $AUTOENV_AUTH_FILE
-  $ _autoenv_ask_for_yes() { echo "no"; return 1 }
-  $ cd .
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/autoenv.t/.autoenv.zsh (glob)
-  
-  **********************************************
-  
-  echo ENTERED
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') no
-
-
-Lets also try one more time to ensure it didn't add it.
-
-  $ _autoenv_ask_for_yes() { echo "yes"; return 0 }
-  $ cd .
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/autoenv.t/.autoenv.zsh (glob)
-  
-  **********************************************
-  
-  echo ENTERED
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') yes
-  ENTERED
-
-Reloading the script should keep the current state, e.g. when reloading your
-~/.zshrc.
-
-  $ $TEST_SOURCE_AUTOENV
-  $ cd .
diff --git a/tests/autoenv_utils.t b/tests/autoenv_utils.t
deleted file mode 100644 (file)
index e3d2271..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-Tests for provided utils/helpers.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-  $ PATH=
-  $ autoenv_prepend_path custom_path
-  $ echo $PATH
-  custom_path
-
-  $ autoenv_prepend_path custom_path
-  $ echo $PATH
-  custom_path
-
-  $ autoenv_prepend_path another_path a_third_one
-  $ echo $PATH
-  a_third_one:another_path:custom_path
-
-  $ autoenv_remove_path another_path a_third_one
-  $ echo $PATH
-  custom_path
-
-  $ autoenv_remove_path does_not_exist
-  [1]
-  $ echo $PATH
-  custom_path
-
-  $ autoenv_remove_path custom_path
-  $ echo PATH:$PATH
-  PATH:
diff --git a/tests/cwd.t b/tests/cwd.t
deleted file mode 100644 (file)
index 97bc5f8..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-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
diff --git a/tests/leave.t b/tests/leave.t
deleted file mode 100644 (file)
index 9cad5d0..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-  $ source $TESTDIR/setup.zsh || return 1
-
-Lets set a simple .autoenv.zsh action
-
-  $ mkdir sub
-  $ cd sub
-  $ echo 'echo ENTERED' > .autoenv.zsh
-  $ echo 'echo LEFT' > .autoenv_leave.zsh
-
-Change to the directory.
-
-  $ _autoenv_ask_for_yes() { echo "yes"; return 0 }
-  $ cd .
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/leave.t/sub/.autoenv.zsh (glob)
-  
-  **********************************************
-  
-  echo ENTERED
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') yes
-  ENTERED
-
-
-Leave the directory and answer "no".
-
-  $ _autoenv_ask_for_yes() { echo "no"; return 1 }
-  $ cd ..
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/leave.t/sub/.autoenv_leave.zsh (glob)
-  
-  **********************************************
-  
-  echo LEFT
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') no
-
-
-  $ cd sub
-  ENTERED
-  $ _autoenv_ask_for_yes() { echo "yes"; return 0 }
-  $ cd ..
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/leave.t/sub/.autoenv_leave.zsh (glob)
-  
-  **********************************************
-  
-  echo LEFT
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') yes
-  LEFT
-
-
-Now check with subdirs, looking upwards.
-
-  $ AUTOENV_LOOK_UPWARDS=1
-  $ mkdir sub/child
-  $ cd sub/child
-  ENTERED
-  $ cd .
-  $ cd ..
-  $ cd ..
-  LEFT
-
-
-Now check with subdirs, not looking at parent dirs.
-
-  $ AUTOENV_LOOK_UPWARDS=0
-  $ cd sub/child
-  $ cd ..
-  ENTERED
-  $ cd child
-  $ cd ../..
-  LEFT
-
-
-Test that .autoenv.zsh is sourced only once with AUTOENV_HANDLE_LEAVE=0.
-
-  $ unset _autoenv_stack_entered
-  $ AUTOENV_HANDLE_LEAVE=0
-  $ cd sub
-  ENTERED
-  $ cd ..
-  $ cd sub
-
-
-Test that "leave" is not triggered when entering an outside dir via symlink.
-
-  $ AUTOENV_HANDLE_LEAVE=1
-  $ cd ..
-  LEFT
-  $ mkdir outside
-  $ cd outside
-  $ echo 'echo ENTERED outside: PWD:${PWD:t} pwd:${${"$(pwd)"}:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t} event:${autoenv_event}' > .autoenv.zsh
-  $ echo 'echo LEFT outside: PWD:${PWD:t} pwd:${${"$(pwd)"}:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t} event:${autoenv_event}' > .autoenv_leave.zsh
-  $ echo 'echo LEFT: autoenv_env_file:${autoenv_env_file}' >> .autoenv_leave.zsh
-  $ test_autoenv_auth_env_files
-
-  $ cd ..
-  $ ln -s ../outside sub/symlink
-  $ cd sub
-  ENTERED
-  $ cd symlink
-  ENTERED outside: PWD:symlink pwd:symlink from:sub to:symlink event:enter
-
-  $ cd ../..
-  LEFT
-  LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave
-  LEFT: autoenv_env_file:*/leave.t/sub/symlink/.autoenv_leave.zsh (glob)
-  $ cd sub/symlink
-  ENTERED outside: PWD:symlink pwd:symlink from:leave.t to:symlink event:enter
-
-$autoenv_env_file should not be exported.
-
-  $ echo -n $autoenv_env_file
-
-$autoenv_env_file should be reset when leaving.
-
-  $ echo -n $autoenv_env_file
-  $ cd ../..
-  LEFT outside: PWD:leave.t pwd:leave.t from:symlink to:leave.t event:leave
-  LEFT: autoenv_env_file:*/leave.t/sub/symlink/.autoenv_leave.zsh (glob)
-  $ echo ${autoenv_env_file:-empty}
-  empty
diff --git a/tests/recurse-upwards.t b/tests/recurse-upwards.t
deleted file mode 100644 (file)
index f49cc3e..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-Test recursing into parent .autoenv.zsh files.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Setup env actions / output.
-
-  $ AUTOENV_LOOK_UPWARDS=1
-
-Create env files in root dir.
-
-  $ echo 'echo ENTERED_root: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv.zsh
-  $ echo 'echo LEFT_root: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv_leave.zsh
-  $ test_autoenv_auth_env_files
-
-Create env files in sub dir.
-
-  $ mkdir -p sub/sub2
-  $ cd sub
-  ENTERED_root: PWD:sub from:recurse-upwards.t to:sub
-
-  $ echo 'echo ENTERED_sub: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv.zsh
-  $ echo 'echo LEFT_sub: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv_leave.zsh
-  $ test_autoenv_auth_env_files
-
-The actual tests.
-
-  $ cd .
-  ENTERED_sub: PWD:sub from:sub to:sub
-
-  $ cd ..
-  LEFT_sub: PWD:recurse-upwards.t from:sub to:recurse-upwards.t
-
-  $ cd sub/sub2
-  ENTERED_sub: PWD:sub2 from:recurse-upwards.t to:sub2
-
-  $ cd ..
-
-Changing the .autoenv.zsh file should re-source it.
-
-  $ echo 'echo ENTER2' >> .autoenv.zsh
-
-Set timestamp of auth file into the past, so it gets seen as new below.
-
-  $ touch -t 201401010101 .autoenv.zsh
-
-  $ test_autoenv_auth_env_files
-  $ cd .
-  ENTERED_sub: PWD:sub from:sub to:sub
-  ENTER2
-
-Add sub/sub2/.autoenv.zsh file, with a call to autoenv_source_parent.
-
-  $ echo "echo autoenv_source_parent_from_sub2:\nautoenv_source_parent\necho done_sub2\n" > sub2/.autoenv.zsh
-  $ test_autoenv_add_to_env sub2/.autoenv.zsh
-  $ cd sub2
-  autoenv_source_parent_from_sub2:
-  ENTERED_sub: PWD:sub2 from:sub to:sub2
-  ENTER2
-  done_sub2
-
-Move sub/.autoenv.zsh away, now the root .autoenv.zsh file should get sourced.
-
-  $ mv ../.autoenv.zsh ../.autoenv.zsh.out
-  $ touch -t 201401010102 .autoenv.zsh
-  $ cd .
-  autoenv_source_parent_from_sub2:
-  ENTERED_root: PWD:sub2 from:sub2 to:sub2
-  done_sub2
-  $ mv ../.autoenv.zsh.out ../.autoenv.zsh
-
-Prepend call to autoenv_source_parent to sub/.autoenv.zsh file.
-
-  $ cd ..
-  $ echo -e "echo autoenv_source_parent_from_sub:\nautoenv_source_parent\n$(cat .autoenv.zsh)" >| .autoenv.zsh
-  $ echo "echo done_sub" >> .autoenv.zsh
-  $ touch -t 201401010103 .autoenv.zsh
-  $ test_autoenv_auth_env_files
-
-  $ cd .
-  autoenv_source_parent_from_sub:
-  ENTERED_root: PWD:sub from:sub to:sub
-  ENTERED_sub: PWD:sub from:sub to:sub
-  ENTER2
-  done_sub
-
-
-Add sub/sub2/.autoenv.zsh file.
-
-  $ echo -e "echo autoenv_source_parent_from_sub2:\nautoenv_source_parent\necho done_sub2\n" >| sub2/.autoenv.zsh
-  $ test_autoenv_add_to_env sub2/.autoenv.zsh
-  $ cd sub2
-  autoenv_source_parent_from_sub2:
-  autoenv_source_parent_from_sub:
-  ENTERED_root: PWD:sub2 from:sub to:sub2
-  ENTERED_sub: PWD:sub2 from:sub to:sub2
-  ENTER2
-  done_sub
-  done_sub2
-
-Go to root.
-This should not trigger the enter event, because it was handled via
-autoenv_source_parent already.
-
-  $ cd ../..
-  LEFT_sub: PWD:recurse-upwards.t from:sub2 to:recurse-upwards.t
-
-
-Changing the root .autoenv.zsh should trigger re-authentication via
-autoenv_source_parent.
-
-First, let's answer "no".
-
-  $ echo "echo NEW" >| .autoenv.zsh
-  $ _autoenv_ask_for_yes() { echo "no"; return 1 }
-  $ cd sub
-  autoenv_source_parent_from_sub:
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/recurse-upwards.t/.autoenv.zsh (glob)
-  
-  **********************************************
-  
-  echo NEW
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') no
-  ENTERED_sub: PWD:sub from:recurse-upwards.t to:sub
-  ENTER2
-  done_sub
-
-Now with "yes".
-This currently does not trigger re-execution of the .autoenv.zsh file.
-
-  $ _autoenv_ask_for_yes() { echo "yes"; return 0 }
-  $ cd .
-
-Touching the .autoenv.zsh file will now source the parent env file.
-
-  $ touch -t 201401010104 .autoenv.zsh
-  $ cd .
-  autoenv_source_parent_from_sub:
-  Attempting to load unauthorized env file!
-  -* /*/cramtests-*/recurse-upwards.t/.autoenv.zsh (glob)
-  
-  **********************************************
-  
-  echo NEW
-  
-  **********************************************
-  
-  Would you like to authorize it? (type 'yes') yes
-  NEW
-  ENTERED_sub: PWD:sub from:sub to:sub
-  ENTER2
-  done_sub
-
-
-  $ cd ..
-  LEFT_sub: PWD:recurse-upwards.t from:sub to:recurse-upwards.t
-  $ mkdir sub/sub2/sub3
-  $ cd sub/sub2/sub3
-  autoenv_source_parent_from_sub2:
-  autoenv_source_parent_from_sub:
-  NEW
-  ENTERED_sub: PWD:sub3 from:recurse-upwards.t to:sub3
-  ENTER2
-  done_sub
-  done_sub2
diff --git a/tests/setup.zsh b/tests/setup.zsh
deleted file mode 100644 (file)
index 02f41b3..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# Setup for tests.
-#
-# It returns 1 in case of errors, and no tests should be run then!
-#
-# Ensure we have our mocked out AUTOENV_AUTH_FILE
-# (via .zshenv).
-
-# Treat unset variables as errors.
-# Not handled in varstash yet.
-# setopt nounset
-
-export AUTOENV_AUTH_FILE="$CRAMTMP/autoenv/.autoenv_auth"
-
-# Abort this setup script on any error.
-_save_errexit=${options[errexit]}
-set -e
-
-# Can be defined in .zshenv, e.g. tests/ZDOTDIR.loadviafunction/.zshenv.
-if [[ -z $TEST_SOURCE_AUTOENV ]]; then
-  TEST_SOURCE_AUTOENV=(source $TESTDIR/../autoenv.plugin.zsh)
-fi
-$TEST_SOURCE_AUTOENV
-
-# Reset any authentication.
-if [[ -f $AUTOENV_AUTH_FILE ]]; then
-  echo -n >| $AUTOENV_AUTH_FILE
-fi
-
-# Add file ($1), version ($2), and optional hash ($3) to authentication file.
-test_autoenv_add_to_env() {
-  emulate -L zsh
-  [[ -d ${AUTOENV_AUTH_FILE:h} ]] || mkdir -p ${AUTOENV_AUTH_FILE:h}
-  _autoenv_deauthorize $1
-  {
-    local ret_pair
-    _autoenv_hash_pair $1 2 ${2:-} && echo $ret_pair
-  } >>| $AUTOENV_AUTH_FILE
-}
-
-# Add enter and leave env files to authentication file.
-test_autoenv_auth_env_files() {
-  local dir=${1:-$PWD}
-  test_autoenv_add_to_env $dir/$AUTOENV_FILE_ENTER
-  test_autoenv_add_to_env $dir/$AUTOENV_FILE_LEAVE
-}
-
-# Now keep on going on errors again.
-options[errexit]=$_save_errexit
-unset _save_errexit
diff --git a/tests/source-parent-until.t b/tests/source-parent-until.t
deleted file mode 100644 (file)
index a6700bb..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-Test recursing into parent .autoenv.zsh files.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Setup env actions / output.
-
-  $ AUTOENV_LOOK_UPWARDS=1
-
-Create env files in root dir.
-
-  $ echo 'echo ENTERED_root: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv.zsh
-  $ echo 'echo LEFT_root: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv_leave.zsh
-  $ test_autoenv_auth_env_files
-
-Create env files in sub dir.
-
-  $ mkdir -p sub/sub2/sub3/sub4
-  $ cd sub
-  ENTERED_root: PWD:sub from:source-parent-until.t to:sub
-
-  $ echo 'echo ENTERED_sub: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv.zsh
-  $ echo 'echo LEFT_sub: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv_leave.zsh
-  $ test_autoenv_auth_env_files
-
-  $ cd sub2
-  ENTERED_sub: PWD:sub2 from:sub to:sub2
-  $ echo 'echo ENTERED_sub2: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv.zsh
-  $ echo 'echo LEFT_sub2: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv_leave.zsh
-  $ test_autoenv_auth_env_files
-
-The actual tests.
-
-# $ cd sub3
-# ENTERED_sub2: PWD:sub3 from:sub2 to:sub3
-# $ cd ../..
-# LEFT_sub2: PWD:sub from:sub3 to:sub
-  $ cd ..
-
-Add sub/sub2/sub3/.autoenv.zsh file, with a call to autoenv_source_parent,
-stopping at the parent dir.
-
-  $ echo "echo autoenv_source_parent_from_sub3:\nautoenv_source_parent ..\necho done_sub3\n" > sub2/sub3/.autoenv.zsh
-  $ test_autoenv_add_to_env sub2/sub3/.autoenv.zsh
-  $ cd sub2/sub3
-  autoenv_source_parent_from_sub3:
-  ENTERED_sub2: PWD:sub3 from:sub to:sub3
-  done_sub3
-
-Look up to `../..` now.
-
-  $ cd ../..
-  LEFT_sub2: PWD:sub from:sub3 to:sub
-  $ echo "echo autoenv_source_parent_from_sub3:\nautoenv_source_parent ../..\necho done_sub3\n" >| sub2/sub3/.autoenv.zsh
-  $ test_autoenv_add_to_env sub2/sub3/.autoenv.zsh
-  $ cd sub2/sub3
-  autoenv_source_parent_from_sub3:
-  ENTERED_sub2: PWD:sub3 from:sub to:sub3
-  done_sub3
-
-Remove intermediate .autoenv.zsh from sub2.
-
-  $ cd ../..
-  LEFT_sub2: PWD:sub from:sub3 to:sub
-  $ rm sub2/.autoenv.zsh
-
-Should source "sub" for ../.. now.
-
-  $ echo "echo autoenv_source_parent_from_sub3:\nautoenv_source_parent ../..\necho done_sub3\n" >| sub2/sub3/.autoenv.zsh
-  $ test_autoenv_add_to_env sub2/sub3/.autoenv.zsh
-  $ cd sub2/sub3
-  autoenv_source_parent_from_sub3:
-  ENTERED_sub: PWD:sub3 from:sub to:sub3
-  done_sub3
-
-Should source nothing for .. now.
-
-  $ cd ../..
-  $ echo "echo autoenv_source_parent_from_sub3:\nautoenv_source_parent ..\necho done_sub3\n" >| sub2/sub3/.autoenv.zsh
-  $ test_autoenv_add_to_env sub2/sub3/.autoenv.zsh
-  $ cd sub2/sub3
-  autoenv_source_parent_from_sub3:
-  done_sub3
-
-Look up to "/" (default).
-
-  $ cd ../..
-  $ echo "echo autoenv_source_parent_from_sub3:\nautoenv_source_parent /\necho done_sub3\n" >| sub2/sub3/.autoenv.zsh
-  $ test_autoenv_add_to_env sub2/sub3/.autoenv.zsh
-  $ cd sub2/sub3
-  autoenv_source_parent_from_sub3:
-  ENTERED_sub: PWD:sub3 from:sub to:sub3
-  done_sub3
-
-Handles dirs with spaces.
-
-  $ mkdir "dir with space"
-  $ echo "echo entered \$PWD\n" >| "dir with space/.autoenv.zsh"
-  $ test_autoenv_add_to_env "dir with space/.autoenv.zsh"
-  $ cd "dir with space"
-  entered */dir with space (glob)
-
-Handles dirs with spaces outside any root (should not hang).
-
-  $ cd $CRAMTMP || exit
-  LEFT_root: * (glob)
-  LEFT_sub: * (glob)
-  $ mkdir "dir with space"
-  $ cd "dir with space"
diff --git a/tests/source-parent-vars.t b/tests/source-parent-vars.t
deleted file mode 100644 (file)
index 36b0ec7..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-Test vars with autoenv_source_parent.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Setup env actions / output.
-
-  $ AUTOENV_LOOK_UPWARDS=1
-
-Create env files in root dir.
-
-  $ echo 'echo ENTERED_root: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv.zsh
-  $ echo 'echo LEFT_root: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > .autoenv_leave.zsh
-  $ test_autoenv_auth_env_files
-
-Create env files in sub dir.
-
-  $ mkdir -p sub/sub2
-  $ echo 'echo ENTERED_sub: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > sub/.autoenv.zsh
-  $ echo 'echo LEFT_sub: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > sub/.autoenv_leave.zsh
-  $ test_autoenv_auth_env_files sub
-
-  $ echo 'echo ENTERED_sub2: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > sub/sub2/.autoenv.zsh
-  $ echo 'echo LEFT_sub2: PWD:${PWD:t} from:${autoenv_from_dir:t} to:${autoenv_to_dir:t}' > sub/sub2/.autoenv_leave.zsh
-  $ echo 'echo autoenv_source_parent_from_sub2\n' >> sub/sub2/.autoenv.zsh
-  $ echo 'echo autoenv_env_file_1:${autoenv_env_file:h:t}\nautoenv_source_parent\n' >> sub/sub2/.autoenv.zsh
-  $ echo 'echo autoenv_env_file_2:${autoenv_env_file:h:t}\necho done_sub3\n' >> sub/sub2/.autoenv.zsh
-  $ test_autoenv_auth_env_files sub/sub2
-
-The actual tests.
-
-  $ cd sub/sub2
-  ENTERED_sub2: PWD:sub2 from:source-parent-vars.t to:sub2
-  autoenv_source_parent_from_sub2
-  autoenv_env_file_1:sub2
-  ENTERED_sub: PWD:sub2 from:source-parent-vars.t to:sub2
-  autoenv_env_file_2:sub2
-  done_sub3
-
diff --git a/tests/upgrade_hash.t b/tests/upgrade_hash.t
deleted file mode 100644 (file)
index bf9df47..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-Tests for upgrading hashes.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-  $ mkdir -p sub
-  $ mkdir -p ${AUTOENV_AUTH_FILE:h}
-
-Create a single v1 hash entry.
-
-  $ echo 'echo ENTERED' > sub/$AUTOENV_FILE_ENTER
-  $ echo 'echo LEAVE' > sub/$AUTOENV_FILE_LEAVE
-
-  $ echo :$PWD/sub/$AUTOENV_FILE_ENTER:4c403f1870af2ab5472370a42b6b2b488cefe83c:1 >| $AUTOENV_AUTH_FILE
-  $ cd sub
-  ENTERED
-
-Hashes should get upgraded automatically.
-This also tests that there are no empty lines being added to the auth file when
-de-authenticating the old hash.
-
-  $ cat $AUTOENV_AUTH_FILE
-  :/*/cramtests-*/upgrade_hash.t/sub/.autoenv.zsh:3679467995.13:2 (glob)
-
-Re-create auth file with v1 hashes for both auth files.
-
-  $ echo :$PWD/$AUTOENV_FILE_LEAVE:882cf0333ea3c35537c9459c08d8987f25087ea9:1 >| $AUTOENV_AUTH_FILE
-  $ echo :$PWD/$AUTOENV_FILE_ENTER:4c403f1870af2ab5472370a42b6b2b488cefe83c:1 >>| $AUTOENV_AUTH_FILE
-
-Only the leave file's hash should get updated.
-
-  $ cd ..
-  LEAVE
-  $ cat $AUTOENV_AUTH_FILE
-  :/*/cramtests-*/upgrade_hash.t/sub/.autoenv.zsh:4c403f1870af2ab5472370a42b6b2b488cefe83c:1 (glob)
-  :/*/cramtests-*/upgrade_hash.t/sub/.autoenv_leave.zsh:803077150.11:2 (glob)
-
-The enter file's hash should get updated.
-
-  $ cd sub
-  ENTERED
-  $ cat $AUTOENV_AUTH_FILE
-  :/*/cramtests-*/upgrade_hash.t/sub/.autoenv_leave.zsh:803077150.11:2 (glob)
-  :/*/cramtests-*/upgrade_hash.t/sub/.autoenv.zsh:3679467995.13:2 (glob)
diff --git a/tests/varstash-alias.t b/tests/varstash-alias.t
deleted file mode 100644 (file)
index 87a765f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-Test varstash integration with regard to aliases.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Setup test environment.
-
-  $ mkdir sub
-  $ cd sub
-  $ echo 'echo ENTER' > $AUTOENV_FILE_ENTER
-  $ echo 'autostash alias some_alias="echo NEW_ALIAS"' >> $AUTOENV_FILE_ENTER
-  $ echo 'echo LEAVE' > $AUTOENV_FILE_LEAVE
-  $ test_autoenv_auth_env_files
-
-Aliases should be stashed.
-
-  $ alias some_alias="echo ORIG_ALIAS"
-  $ some_alias
-  ORIG_ALIAS
-  $ cd .
-  ENTER
-  $ some_alias
-  NEW_ALIAS
-  $ cd ..
-  LEAVE
-  $ some_alias
-  ORIG_ALIAS
-
-Aliases should be stashed, if there are also environment variables.
-
-  $ some_alias=ENV_VAR
-  $ some_alias
-  ORIG_ALIAS
-  $ cd sub
-  ENTER
-  $ type -w some_alias
-  some_alias: alias
-  $ echo $some_alias
-  ENV_VAR
diff --git a/tests/varstash-unstash-on-leave.t b/tests/varstash-unstash-on-leave.t
deleted file mode 100644 (file)
index c5cc125..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-Test unstash behavior on leaving.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Setup test environment.
-
-  $ mkdir -p sub/sub2
-  $ echo 'echo ENTER; stash FOO=changed' >| sub/$AUTOENV_FILE_ENTER
-  $ echo 'echo LEAVE; unstash FOO' >| sub/$AUTOENV_FILE_LEAVE
-  $ test_autoenv_auth_env_files sub
-  $ FOO=orig
-
-Activating the env stashes it and applies a new value.
-
-  $ cd sub/sub2
-  ENTER
-  $ echo $FOO
-  changed
-
-Leaving the directory unstashes it (varstash_dir is set to prev dir).
-
-  $ cd -
-  LEAVE
-  $ echo $FOO
-  orig
diff --git a/tests/varstash.t b/tests/varstash.t
deleted file mode 100644 (file)
index 3e4b3dc..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-Test varstash integration.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Setup test environment.
-
-  $ mkdir sub
-  $ cd sub
-
-The varstash library should not get loaded always.
-
-  $ echo 'echo ENTER' > $AUTOENV_FILE_ENTER
-  $ echo 'echo LEAVE' > $AUTOENV_FILE_LEAVE
-  $ test_autoenv_auth_env_files
-  $ cd .
-  ENTER
-  $ type -w autostash
-  autostash: none
-  [1]
-
-Now on to some stashing.
-
-  $ echo 'echo ENTER; autostash FOO=changed' >| $AUTOENV_FILE_ENTER
-  $ echo 'echo LEAVE; autounstash' >| $AUTOENV_FILE_LEAVE
-  $ test_autoenv_auth_env_files
-
-Set environment variable.
-
-  $ FOO=orig
-
-Activating the env stashes it and applies a new value.
-
-  $ cd ..
-  LEAVE
-  $ cd sub
-  ENTER
-  $ type -w autostash
-  autostash: function
-  $ echo $FOO
-  changed
-
-Leaving the directory unstashes it.
-
-  $ cd ..
-  LEAVE
-  $ echo $FOO
-  orig
-
-
-Test autounstashing when leaving a directory.  {{{
-
-Setup:
-
-  $ unset VAR
-  $ cd sub
-  ENTER
-  $ echo 'echo ENTER; autostash VAR=changed' >| $AUTOENV_FILE_ENTER
-  $ echo 'echo LEAVE; echo "no explicit call to autounstash"' >| $AUTOENV_FILE_LEAVE
-  $ test_autoenv_auth_env_files
-
-$VAR is unset:
-
-  $ echo VAR_set:$+VAR
-  VAR_set:0
-
-Trigger the autostashing in the enter file.
-
-  $ cd ..
-  LEAVE
-  no explicit call to autounstash
-  $ cd sub
-  ENTER
-  $ echo $VAR
-  changed
-
-Now leave again.
-
-  $ cd ..
-  LEAVE
-  no explicit call to autounstash
-  $ echo VAR_set:$+VAR
-  VAR_set:0
-
-Remove the leave file, auto-unstashing should still happen.
-
-  $ rm sub/$AUTOENV_FILE_LEAVE
-  $ cd sub
-  ENTER
-  $ echo $VAR
-  changed
-  $ cd ..
-  $ echo VAR_set:$+VAR
-  VAR_set:0
-
-And once again where a value gets restored.
-
-  $ VAR=orig_2
-  $ echo $VAR
-  orig_2
-  $ cd sub
-  ENTER
-  $ echo $VAR
-  changed
-  $ cd ..
-  $ echo $VAR
-  orig_2
-
-}}}
-
-autostash does not issue a warning, and no other output. {{{
-
-  $ autostash something=1 something_else=2
-  $ echo $something $something_else
-  1 2
-  $ stash something=1.2 something_else=2.2
-  $ echo $something $something_else
-  1.2 2.2
-  $ stash something something_else
-  You have already stashed something, please specify "-f" if you want to overwrite another stashed value.
-  You have already stashed something_else, please specify "-f" if you want to overwrite another stashed value.
-
-Should not be set anymore.
-
-  $ autounstash
-  $ echo ${+something} ${+something_else}
-  0 0
-
-}}}
diff --git a/tests/varstash_export.t b/tests/varstash_export.t
deleted file mode 100644 (file)
index 9936d7e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-Test varstash with exported variables in subshell.
-
-  $ source $TESTDIR/setup.zsh || return 1
-
-Setup test environment.
-
-  $ mkdir sub
-  $ cd sub
-  $ echo 'echo ENTER; autostash MYVAR=changed; autostash MYEXPORT=changed_export' > $AUTOENV_FILE_ENTER
-  $ echo 'echo LEAVE; autounstash' > $AUTOENV_FILE_LEAVE
-
-Manually create auth file
-
-  $ test_autoenv_auth_env_files
-
-Set environment variable.
-
-  $ MYVAR=orig
-  $ export MYEXPORT=orig_export
-
-Activating the env stashes it and applies a new value.
-
-  $ cd .
-  ENTER
-  $ echo $MYVAR
-  changed
-  $ echo $MYEXPORT
-  changed_export
-
-The variable is not available in a subshell, only the exported one.
-
-  $ $TESTSHELL -c 'echo ${MYVAR:-empty}; echo $MYEXPORT'
-  empty
-  changed_export
-
-Activate autoenv in the subshell.
-
-  $ $TESTSHELL -c "$TEST_SOURCE_AUTOENV; echo \${MYVAR}; echo \$MYEXPORT"
-  ENTER
-  changed
-  changed_export
-
-"autounstash" should handle the exported variables.
-
-  $ $TESTSHELL -c "$TEST_SOURCE_AUTOENV; cd ..; echo \${MYVAR:-empty}; echo \$MYEXPORT"
-  ENTER
-  LEAVE
-  empty
-  orig_export