|
| 1 | +#!/usr/bin/env zsh |
| 2 | +# ------------------------------------------------------------------------------------------------- |
| 3 | +# Copyright (c) 2024 zsh-syntax-highlighting contributors |
| 4 | +# All rights reserved. |
| 5 | +# |
| 6 | +# Redistribution and use in source and binary forms, with or without modification, are permitted |
| 7 | +# provided that the following conditions are met: |
| 8 | +# |
| 9 | +# * Redistributions of source code must retain the above copyright notice, this list of conditions |
| 10 | +# and the following disclaimer. |
| 11 | +# * Redistributions in binary form must reproduce the above copyright notice, this list of |
| 12 | +# conditions and the following disclaimer in the documentation and/or other materials provided |
| 13 | +# with the distribution. |
| 14 | +# * Neither the name of the zsh-syntax-highlighting contributors nor the names of its contributors |
| 15 | +# may be used to endorse or promote products derived from this software without specific prior |
| 16 | +# written permission. |
| 17 | +# |
| 18 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR |
| 19 | +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 20 | +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 21 | +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 24 | +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | +# ------------------------------------------------------------------------------------------------- |
| 27 | +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- |
| 28 | +# vim: ft=zsh sw=2 ts=2 et |
| 29 | +# ------------------------------------------------------------------------------------------------- |
| 30 | + |
| 31 | +BUFFER=$': <foo 9<foo <>foo 9<>foo >foo 9>foo >|foo >\!foo >>foo >>|foo >>\!foo <<<foo <&9 >&9 <&- >&- <&p >&p >&foo &>foo >&|foo >&\!foo &>|foo &>\!foo >>&foo &>>foo >>&|foo >>&\!foo &>>|foo &>>\!foo' |
| 32 | + |
| 33 | +expected_region_highlight=( |
| 34 | + '1 1 builtin' # : |
| 35 | + '3 3 redirection' # < |
| 36 | + '4 6 default' # foo |
| 37 | + '8 9 redirection' # 9< |
| 38 | + '10 12 default' # foo |
| 39 | + '14 15 redirection' # <> |
| 40 | + '16 18 default' # foo |
| 41 | + '20 22 redirection' # 9<> |
| 42 | + '23 25 default' # foo |
| 43 | + '27 27 redirection' # > |
| 44 | + '28 30 default' # foo |
| 45 | + '32 33 redirection' # 9> |
| 46 | + '34 36 default' # foo |
| 47 | + '38 39 redirection' # >| |
| 48 | + '40 42 default' # foo |
| 49 | + '44 45 redirection' # >\! |
| 50 | + '46 48 default' # foo |
| 51 | + '50 51 redirection' # >> |
| 52 | + '52 54 default' # foo |
| 53 | + '56 58 redirection' # >>| |
| 54 | + '59 61 default' # foo |
| 55 | + '63 65 redirection' # >>\! |
| 56 | + '66 68 default' # foo |
| 57 | + '70 72 redirection' # <<< |
| 58 | + '73 75 default' # foo |
| 59 | + '77 78 redirection' # <& |
| 60 | + '79 79 numeric-fd' # 9 |
| 61 | + '81 82 redirection' # >& |
| 62 | + '83 83 numeric-fd' # 9 |
| 63 | + '85 86 redirection' # <& |
| 64 | + '87 87 redirection' # - |
| 65 | + '89 90 redirection' # >& |
| 66 | + '91 91 redirection' # - |
| 67 | + '93 94 redirection' # <& |
| 68 | + '95 95 redirection' # p |
| 69 | + '97 98 redirection' # >& |
| 70 | + '99 99 redirection' # p |
| 71 | + '101 102 redirection' # >& |
| 72 | + '103 105 default' # foo |
| 73 | + '107 108 redirection' # &> |
| 74 | + '109 111 default' # foo |
| 75 | + '113 115 redirection' # >&| |
| 76 | + '116 118 default' # foo |
| 77 | + '120 122 redirection' # >&\! |
| 78 | + '123 125 default' # foo |
| 79 | + '127 129 redirection' # &>| |
| 80 | + '130 132 default' # foo |
| 81 | + '134 136 redirection' # &>\! |
| 82 | + '137 139 default' # foo |
| 83 | + '141 143 redirection' # >>& |
| 84 | + '144 146 default' # foo |
| 85 | + '148 150 redirection' # &>> |
| 86 | + '151 153 default' # foo |
| 87 | + '155 158 redirection' # >>&| |
| 88 | + '159 161 default' # foo |
| 89 | + '163 166 redirection' # >>&\! |
| 90 | + '167 169 default' # foo |
| 91 | + '171 174 redirection' # &>>| |
| 92 | + '175 177 default' # foo |
| 93 | + '179 182 redirection' # &>>\! |
| 94 | + '183 185 default' # foo |
| 95 | +) |
0 commit comments