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

@@ -17,7 +17,8 @@ _Note_: `$region_highlight` uses the same `"$i $j $style"` syntax but interprets
**Isolation**: Each test is run in a separate subshell, so any variables, aliases, functions, etc.,
it defines will be visible to the tested code (that computes `$region_highlight`), but will not affect
subsequent tests.
subsequent tests. The current working directory of tests is set to a newly-created empty directory,
which is automatically cleaned up after the test exits.
highlighting test