Commit graph

96 commits

Author SHA1 Message Date
Daniel Shahaf
a636527f70 tests: Add an XFail test for issue #228, "Support the PATH_DIRS option".
This builds upon the test harness auto-cleaned-up directories work (c01533920).
2015-11-16 23:04:11 +00:00
Daniel Shahaf
2b35ff1c15 minor: Rename a test file to a not-escape-needing name.
There's simply no reason to use such names, now that the filename is no longer
itself test data.
2015-11-16 22:57:47 +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
3620ad951f Add an XFail test for issue #231, "Assignment terminating subshell flags closing parenthesis as an error". 2015-11-16 19:04:37 +00:00
Daniel Shahaf
b285c7b821 brackets: Highlight closing ')' of array assignments correctly. (Issue #226.)
Followup to c0dafd1d85, which changed the highlight of
those ')'s from <nothing> to [reserved-word].
2015-11-16 18:44:44 +00:00
Daniel Shahaf
c0dafd1d85 brackets: Highlight the closing brackets of subshells and blocks. (Issue #226.) 2015-10-30 20:20:30 +02:00
Daniel Shahaf
a59f442d2d brackets: Highlight the closing brackets of arithmetic expansion. (Issue #226.) 2015-10-30 17:28:48 +00:00
Daniel Shahaf
8b4adbd991 Fix issue #222, "command word after repeat". 2015-10-30 13:31:43 +00:00
Daniel Shahaf
6fbd2aa957 Add an XFail test for issue #222, "command word after repeat". 2015-10-30 13:31:23 +00:00
Daniel Shahaf
9e178f9f39 subshells: Highlight the opening parenthesis correctly. (Issue #166.)
Followup to 0d1bfbcbfa.
2015-10-30 11:38:32 +02:00
Daniel Shahaf
5a38710564 subshells: Add an XFail test demonstrating that #166 is not yet fixed.
Reported-by: Antony Lee
2015-10-30 09:34:01 +00:00
Daniel Shahaf
1ac39b0af1 comments: Mark prematurely-terminated command as an error.
This is already done for commands prematurely terminated by ";".
2015-10-30 08:38:45 +02:00
Daniel Shahaf
693de99a90 comments: Fix issue #163 and #167: Highlight comments. 2015-10-30 08:38:44 +02:00
Daniel Shahaf
e76f208cf8 comments: Add a PASSing test for the NO_INTERACTIVE_COMMENTS case. 2015-10-30 08:38:39 +02:00
Daniel Shahaf
e9ceb2017e comments: Add XFail tests from issues #163 and #167.
These tests are based on the patches contributed in those issues:

    commit 9d9df4fe80 (upstream/pr/167)
    Author:     Miciah Masters <miciah.masters@gmail.com>
    AuthorDate: Thu Apr 23 20:28:24 2015 -0400
    Commit:     Miciah Dashiel Butler Masters <mmasters@redhat.com>
    CommitDate: Thu Apr 23 20:28:24 2015 -0400

        Highlight comments

    M       highlighters/main/main-highlighter.zsh
    A       highlighters/main/test-data/comments.zsh

    commit d94f1a037f (upstream/pr/163)
    Author:     sonnym <michaud.sonny@gmail.com>
    AuthorDate: Fri Mar 6 18:27:57 2015 -0500
    Commit:     sonnym <michaud.sonny@gmail.com>
    CommitDate: Fri Mar 6 21:16:27 2015 -0500

        highlight comments when interactive_comments is on

    M       highlighters/main/main-highlighter.zsh
    A       highlighters/main/test-data/comment-embedded.zsh
    A       highlighters/main/test-data/comment-leading.zsh

Patch-by: sonnym <michaud.sonny@gmail.com>
Patch-by: Miciah Masters <miciah.masters@gmail.com>
(corrected and refreshed for harness changes by me)
2015-10-29 18:08:30 +02:00
Daniel Shahaf
2f05620b19 sudo: Flag an error when a required argument is missing. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
f49f3bf0c0 sudo: Extend tests. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
a3047a9121 sudo: Highlight an empty sudo; as an error.
The word following 'sudo' was considered :regular:, although it isn't.
2015-10-29 12:01:13 +00:00
Daniel Shahaf
86e9249709 sudo/redirections: Fix remaining part of issue #221, "sudo and redirection don't mix". 2015-10-29 12:01:13 +00:00
Daniel Shahaf
0d1bfbcbfa Highlight subshells and anonymous functions correctly.
Fixes zsh-users/zsh-syntax-highlighting#166.
Fixes zsh-users/zsh-syntax-highlighting#194.
Builds upon the issue #207 work.
2015-10-29 12:01:13 +00:00
Daniel Shahaf
2218e26bf8 command word: Highlight 'else' correctly. Part of issue #207. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
b397b12ac1 command word: Start fixing issue #207, "Word following certain reserved words should be a command word". 2015-10-29 12:01:13 +00:00
Daniel Shahaf
87deac3062 command word: Add an XFail test for issue #207. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
01d7eeb3c7 Fix issue #205, "';' after assignment is highlighted as unknown-token". 2015-10-29 12:01:13 +00:00
Daniel Shahaf
be006aded5 sudo/redirections: Fix part of issue #221, "sudo and redirection don't mix". 2015-10-29 12:01:11 +00:00
Daniel Shahaf
c6355a31b7 Followup to last: re-fix issue #9 and add test for it.
The fix for issue #9 was accidentally broken by the penultimate commit.

Note that we don't care about aliases to ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR
entries, since the code deals with aliases at command position.
2015-10-29 12:01:11 +00:00
Daniel Shahaf
2c9f8c8c95 Fix issue #209, "precommand modifiers at non-command-word position". 2015-10-29 12:01:11 +00:00
Daniel Shahaf
80d692c400 command word: Add an XFail test for issue #194, "Highlight anonymous functions". 2015-10-29 12:01:11 +00:00
Daniel Shahaf
e49251b6fa sudo/redirections: Add two XFail tests for issue #221, "sudo and redirection don't mix". 2015-10-29 12:01:09 +00:00
Daniel Shahaf
59fbdda64c main: Refresh highlighting upon accept-* widgets (accept-line et al).
Use this to remove [path_prefix] highlighting during accept-* widgets.
This causes ": file.tx<CR>" to remove the underline from "file.tx", like
": file.tx<SPACE>" already does.  (Assume 'file.txt' exists.)
2015-10-28 09:24:08 +02:00
Daniel Shahaf
7723edf4f5 Add an XFail test for accept-line semantics. 2015-10-28 08:30:05 +02:00
Daniel Shahaf
feec9f58c9 Followup to last: Fix issue number in comment. 2015-10-27 13:38:40 +02:00
Daniel Shahaf
ed6d229b1c Add XFail test for issue #208, 'precommand modifiers at non-command-word position'. 2015-10-27 12:33:11 +02:00
Daniel Shahaf
9816fcf055 redirections: Test an infix redirection. 2015-10-27 05:20:24 +00:00
Daniel Shahaf
871af68082 sudo: Extend test to cover all codepaths. 2015-10-27 05:09:13 +00:00
Daniel Shahaf
98aee7f8b9 Remove path_approx.
Fixes zsh-users/zsh-syntax-highlighting#187.
Adds a test for zsh-users/zsh-syntax-highlighting#204.
2015-10-27 04:29:05 +00:00
Daniel Shahaf
20d106bd4d noop: Associate an XFAIL test with its issue. 2015-10-23 04:57:05 +00:00
Daniel Shahaf
d66113c1ed Add XFAIL test for issue #205, "';' highlighted as unknown-token". 2015-10-23 04:56:02 +00:00
Daniel Shahaf
728ed66ff9 Fix copyright year.
Followup to b2ac98b981.
2015-10-23 04:53:06 +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
Daniel Shahaf
b2ac98b981 Fix issue #216: test failure with HOME=/nonexistent.
Make the test pass by setting explicitly the global state (existing $HOME) it
depends on.  Test another value of the global state (a non-existing $HOME).
2015-10-23 03:51:06 +00:00
Antony Lee
22c8736e2b Add XFAIL test for issue #160, "subshells highlighted incorrectly". 2015-10-23 03:31:00 +00:00
Daniel Shahaf
c30301d474 Drop unnecessary shebang lines.
All these files should be sourced, not executed; and Debian's lintian complains:

W: zsh-syntax-highlighting: script-not-executable usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
2015-10-20 11:49:51 +00:00
Daniel Shahaf
5cd1fb26c0 Resolve tilde expansions in command word.
This causes '~/bin/foo' to highlight as a command, rather than as a file.

Part of issue #201.
2015-09-30 00:49:34 +00:00
Daniel Shahaf
69203b1a1d Don't highlight escaped globbing.
Fixes zsh-users/zsh-syntax-highlighting#193.
2015-09-29 23:44:57 +00:00
Daniel Shahaf
800158745a Highlight quoted command words correctly.
Fixes zsh-users/zsh-syntax-highlighting#147.
2015-09-28 19:49:39 +00:00
Daniel Shahaf
7b4598a764 Highlight arithmetic expansions.
Fixes zsh-users/zsh-syntax-highlighting#188 in the case that both the
opening '((' and closing '))' have been typed,  The case that only the
opening '((' have been typed is also fixed, but requires a zsh development
build (zsh-5.1.1-52-g4bed2cf or newer); see comments within.
2015-09-28 13:55:38 +00:00
Daniel Shahaf
52a2ef644b Don't highlight escaped globbing.
Fixes zsh-users/zsh-syntax-highlighting#193.
2015-09-27 16:28:32 +00:00
Daniel Shahaf
6488284814 back-dollar-quoted-argument: Highlight incomplete escape sequences as unknown-token
Followup to 219184f046, which fixed issue #196.
2015-09-27 15:59:04 +00:00
Daniel Shahaf
f657406159 minor: Fix comment in last ocmmit. 2015-09-26 18:59:16 +00:00