tests: Document test isolation, implemented some time ago.

This commit is contained in:
Daniel Shahaf 2015-11-16 22:31:18 +00:00
parent e1078a8b4c
commit b5d02a2f49

View File

@ -3,7 +3,9 @@ zsh-syntax-highlighting / tests
Utility scripts for testing zsh-syntax-highlighting highlighters.
The tests expect the highlighter directory to contain a `test-data` directory with test data files. See the [main highlighter](../highlighters/main/test-data) for examples.
The tests harness expects the highlighter directory to contain a `test-data`
directory with test data files.
See the [main highlighter](../highlighters/main/test-data) for examples.
Each test should define the array parameter `$expected_region_highlight`.
The value of that parameter is a list of `"$i $j $style [$todo]"` strings.
@ -13,6 +15,10 @@ If `$todo` exists, the test point is marked as TODO (the failure of that test po
_Note_: `$region_highlight` uses the same `"$i $j $style"` syntax but interprets the indexes differently.
**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.
highlighting test
-----------------