Commit Graph

30 Commits

Author SHA1 Message Date
Daniel Shahaf
b989ae23d0 docs copyedit: Rewrap to 80 columns, part 3. 2015-11-24 06:06:16 +00:00
Daniel Shahaf
3f163a2fd4 docs copyedit: Rewrap to 80 columns, part 2. 2015-11-24 06:06:16 +00:00
Daniel Shahaf
9ce97cd64d docs copyedit: minor. 2015-11-24 06:06:16 +00:00
Daniel Shahaf
49f7beecb5 docs copyedit: Review toplevel and tests README.md files. 2015-11-24 06:06:16 +00:00
Daniel Shahaf
6c033e62e9 docs copyedit: Whitespace. 2015-11-24 06:06:16 +00:00
Daniel Shahaf
e60737d320 'make perf': Unbreak by porting over 'make test' harness changes.
In particular, tests were relying on the harness to provide a sandbox working
directory, but the perf harness wasn't providing that.
2015-11-18 17:52:46 +00:00
Daniel Shahaf
1397f1bae1 tests: Tweak the isolation wrapper for style and robustness.
Followup to c015339202.

Suggested-by: Matthew Martin
2015-11-17 01:06:50 +00:00
Daniel Shahaf
c015339202 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.
2015-11-16 22:54:52 +00:00
Daniel Shahaf
b5d02a2f49 tests: Document test isolation, implemented some time ago. 2015-11-16 22:31:18 +00:00
Daniel Shahaf
6fe07c0961 'make test': Fix breakage introduced by 4d3da30f8b726c6e0eeb3adda06adc9eaa329b3b:
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.
2015-10-27 11:59:20 +02:00
Daniel Shahaf
4513eaea71 'make perf': New target. 2015-10-27 09:47:09 +02:00
Daniel Shahaf
4d3da30f8b 'make test': Colorize output.
Color is only added when "make test"'s stdout is a tty.
2015-10-26 14:31:21 +00:00
Daniel Shahaf
663c760cc9 minor: test harness: Convert some global failure modes to TAP "Bail out" mode. 2015-10-23 05:34:15 +00:00
Daniel Shahaf
8b8b19d91f test harness: Fix a bug with empty actual or expected results.
Fixes zsh-users/zsh-syntax-highlighting#217.
2015-10-23 04:48:16 +00:00
Daniel Shahaf
c4a9fe9379 test harness: Exit 1 if a 'todo' test passed. 2015-10-23 04:30:00 +00:00
Daniel Shahaf
11c060ab76 test harness: Fix a bug whereby 'todo' state would propagate to all subsequent test points.
Update expectations on the subshell test (which triggered this bug, since it has
a passing test point following a 'todo' test point).
2015-10-23 04:26:51 +00:00
Matthew Martin
d99aa58aaa test harness: Run each test as a single subshell.
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>
2015-10-23 03:31:00 +00:00
Daniel Shahaf
9e80fe8f02 Bump copyright years. 2015-09-24 16:46:28 +00:00
Daniel Shahaf
aab1b8f50f Follow-up to 547b8be30461: Fix $observed_result calculation.
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.
2015-09-17 23:40:20 +00:00
Daniel Shahaf
4068413dfe tests: Let each test change the highlight styles.
This way, each test can set custom styles to specific highlight contexts
(to differentiate those contexts) without affecting later tests.
2015-09-17 23:35:44 +00:00
Daniel Shahaf
05ab9f7342 tests: Run only *.zsh files.
Otherwise, *.rej patch files would be run by zsh, with unpredictable results.
2015-09-17 20:11:05 +00:00
Daniel Shahaf
c46b8d169e test harness: Fix off-by-one discrepancy between observed and expected.
Fixes issue #195.
2015-09-12 20:48:25 +00:00
Daniel Shahaf
13a8db1d71 tests: exit non-zero upon failure 2015-09-05 09:27:51 +00:00
Daniel Shahaf
667495bfb7 Support multiline strings 2015-01-27 10:23:58 +00:00
Julien Nicoulaud
ef4f5ed638 Fix READMEs 2011-06-12 23:16:41 +02:00
Julien Nicoulaud
0772ddd346 Big refactoring.
* 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
2011-06-12 22:57:14 +02:00
Julien Nicoulaud
ea792cbf87 Add a mechanism for testing the correctness of the highlighting.
Feel free to add more test data !

Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-01-10 23:46:27 +01:00
Julien Nicoulaud
f962bdf1e7 Fix regression 2011-01-06 23:28:41 +01:00
Julien Nicoulaud
0b0b09de64 Fix absolute path in symlink 2011-01-06 23:26:24 +01:00
Julien Nicoulaud
9d63573e4e Issue 30: Add a test script to watch performance 2011-01-06 23:23:29 +01:00