Since the _zsh_highlight_add_highlight that the tests use ignores
ZSH_HIGHLIGHT_STYLES, we can test both an injective mapping and an empty
mapping at once.
Fixeszsh-users/zsh-syntax-highlighting#262.
Currently, 'make quiet-test' uses Perl. However, since it is considered a development
tool rather than a user-facing tool, users and downstream packages needn't install Perl.
Furthermore, even this dev-only dependency may be dropped in the future.
The only difference between tests/tap-filter here and the one in the issue is using
a `cat` subshell v. using 'undef $/; <STDIN>'.
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.
test failure would not be reflected by the exit code of 'make'.
Setting a shell parameter in the left-hand side of a pipe is not visible to
commands after the pipe, because the left-hand side forks. (That's true both
in 'sh' used by 'make' and in 'zsh' that runs tests/test-highlighting.zsh, at
least on my system.) Therefore, move the colorizing hook to where it doesn't
interfere with setting the $something_failed (in tests/test-highlighting.zsh)
and $result (in Makefile) parameters.
That allows tests to be completely independent of each other, so tests that
change global state — such as modify environment variables, define functions or
aliases, or hash commands — will not affect other tests, without needing an
explicit cleanup step.
This enables testing path-tilde-home with and without $HOME set, which is part
of issue #216.
While at it, convert the test harness to TAP. This fixes issue #180 by adding
support for "not ok 42 # TODO" output.
This commit assumes that 'grep' supports POSIX-compliant -q and -v flags.
Patch-by: Matthew Martin <phy1729@gmail.com>
In region_highlight, a spec of the form 'i j foo' with i >= j should have no effect.
Before this commit, however, the {$i..$j} range would happily expand to (5 4 3)
if i > j were the case (e.g., i=5 and j=3).
This breaks vanilla-newline.zsh; the next commit will fix that.
* Don't override user defined styles
* Better modularisation of highlighters
* Allow to define which highlighters are activated
* Allow to define the order in which they are defined
* Minor performance optimizations
* Fixed some variables leak
* Improve documentation
* Brackets highlighter: use ZSH_HIGHLIGHT_STYLES instead of a specific array