From b5d02a2f49e465d83f32d8cd74fde600dbe3563a Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 16 Nov 2015 22:31:18 +0000 Subject: [PATCH] tests: Document test isolation, implemented some time ago. --- tests/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index e82a64b..80525ac 100644 --- a/tests/README.md +++ b/tests/README.md @@ -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 -----------------