mirror of
https://github.com/zsh-users/zsh-syntax-highlighting.git
synced 2025-12-04 21:56:45 +01:00
docs: Enable Syntax Highlighting for Code Snippits
This commit is contained in:
parent
693757bfd7
commit
4fb570e104
12 changed files with 234 additions and 124 deletions
|
|
@ -38,17 +38,19 @@ computes `$region_highlight`), but will not affect 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. For example:
|
||||
|
||||
setopt PATH_DIRS
|
||||
mkdir -p foo/bar
|
||||
touch foo/bar/testing-issue-228
|
||||
chmod +x foo/bar/testing-issue-228
|
||||
path+=( "$PWD"/foo )
|
||||
```zsh
|
||||
setopt PATH_DIRS
|
||||
mkdir -p foo/bar
|
||||
touch foo/bar/testing-issue-228
|
||||
chmod +x foo/bar/testing-issue-228
|
||||
path+=( "$PWD"/foo )
|
||||
|
||||
BUFFER='bar/testing-issue-228'
|
||||
BUFFER='bar/testing-issue-228'
|
||||
|
||||
expected_region_highlight=(
|
||||
"1 21 command" # bar/testing-issue-228
|
||||
)
|
||||
expected_region_highlight=(
|
||||
"1 21 command" # bar/testing-issue-228
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
Writing new tests
|
||||
|
|
@ -56,7 +58,9 @@ Writing new tests
|
|||
|
||||
An experimental tool is available to generate test files:
|
||||
|
||||
zsh -f tests/generate.zsh 'ls -x' acme newfile
|
||||
```zsh
|
||||
zsh -f tests/generate.zsh 'ls -x' acme newfile
|
||||
```
|
||||
|
||||
This generates a `highlighters/acme/test-data/newfile.zsh` test file based on
|
||||
the current highlighting of the given `$BUFFER` (in this case, `ls -x`).
|
||||
|
|
@ -71,11 +75,15 @@ Highlighting test
|
|||
[`test-highlighting.zsh`](tests/test-highlighting.zsh) tests the correctness of
|
||||
the highlighting. Usage:
|
||||
|
||||
zsh test-highlighting.zsh <HIGHLIGHTER NAME>
|
||||
```zsh
|
||||
zsh test-highlighting.zsh <HIGHLIGHTER NAME>
|
||||
```
|
||||
|
||||
All tests may be run with
|
||||
|
||||
make test
|
||||
```zsh
|
||||
make test
|
||||
```
|
||||
|
||||
which will run all highlighting tests and report results in [TAP format][TAP].
|
||||
By default, the results of all tests will be printed; to show only "interesting"
|
||||
|
|
@ -91,8 +99,12 @@ Performance test
|
|||
[`test-perfs.zsh`](tests/test-perfs.zsh) measures the time spent doing the
|
||||
highlighting. Usage:
|
||||
|
||||
zsh test-perfs.zsh <HIGHLIGHTER NAME>
|
||||
```zsh
|
||||
zsh test-perfs.zsh <HIGHLIGHTER NAME>
|
||||
```
|
||||
|
||||
All tests may be run with
|
||||
|
||||
make perf
|
||||
```zsh
|
||||
make perf
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue