tests: Provide an independent, auto-cleaned working directory to each test.

Fixes zsh-users/zsh-syntax-highlighting#182.
Prerequisite for testing issue #228.

* tests/test-highlighting.zsh
  (run_test): Move functionality to run_test_internal; make run_test be a wrapper
    that handles creating and cleaning up the tempdir.

* tests/README.md: Document the new feature.

* "highlighters/main/test-data/path-space- .zsh"
* highlighters/main/test-data/path-tilde-named.zsh
* highlighters/main/test-data/path.zsh
    Change test data to not depend on being run from the source directory.
This commit is contained in:
Daniel Shahaf
2015-11-16 22:54:52 +00:00
parent b5d02a2f49
commit c015339202
5 changed files with 37 additions and 11 deletions

View File

@@ -27,11 +27,13 @@
# vim: ft=zsh sw=2 ts=2 et
# -------------------------------------------------------------------------------------------------
hash -d D=highlighters/main/test-data
mkdir mydir
touch mydir/path-tilde-named.test
hash -d D=mydir
BUFFER='ls ~D/path-tilde-named.zsh'
BUFFER='ls ~D/path-tilde-named.test'
expected_region_highlight=(
"1 2 $ZSH_HIGHLIGHT_STYLES[command]" # ls
"4 26 $ZSH_HIGHLIGHT_STYLES[path]" # ~D/path-tilde-named.zsh
"4 27 $ZSH_HIGHLIGHT_STYLES[path]" # ~D/path-tilde-named.test
)