| 1 |
# Cases lifted from: https://github.com/juliangruber/brace-expansion |
| 2 |
# skip quotes for now |
| 3 |
# "{x,x}" |
| 4 |
# {"x,x"} |
| 5 |
# {x","x} |
| 6 |
# '{a,b}{{a,b},a,b}' |
| 7 |
A{b,{d,e},{f,g}}Z |
| 8 |
PRE-{a,b}{{a,b},a,b}-POST |
| 9 |
\\{a,b}{{a,b},a,b} |
| 10 |
{{a,b} |
| 11 |
{a,b}} |
| 12 |
{,} |
| 13 |
a{,} |
| 14 |
{,}b |
| 15 |
a{,}b |
| 16 |
a{b}c |
| 17 |
a{1..5}b |
| 18 |
a{01..5}b |
| 19 |
a{-01..5}b |
| 20 |
a{-01..5..3}b |
| 21 |
a{001..9}b |
| 22 |
a{b,c{d,e},{f,g}h}x{y,z |
| 23 |
a{b,c{d,e},{f,g}h}x{y,z\\} |
| 24 |
a{b,c{d,e},{f,g}h}x{y,z} |
| 25 |
a{b{c{d,e}f{x,y{{g}h |
| 26 |
a{b{c{d,e}f{x,y{}g}h |
| 27 |
a{b{c{d,e}f{x,y}}g}h |
| 28 |
a{b{c{d,e}f}g}h |
| 29 |
a{{x,y},z}b |
| 30 |
f{x,y{g,z}}h |
| 31 |
f{x,y{{g,z}}h |
| 32 |
f{x,y{{g,z}}h} |
| 33 |
f{x,y{{g}h |
| 34 |
f{x,y{{g}}h |
| 35 |
f{x,y{}g}h |
| 36 |
z{a,b{,c}d |
| 37 |
z{a,b},c}d |
| 38 |
{-01..5} |
| 39 |
{-05..100..5} |
| 40 |
{-05..100} |
| 41 |
{0..5..2} |
| 42 |
{0001..05..2} |
| 43 |
{0001..-5..2} |
| 44 |
{0001..-5..-2} |
| 45 |
{0001..5..-2} |
| 46 |
{01..5} |
| 47 |
{1..05} |
| 48 |
{1..05..3} |
| 49 |
{05..100} |
| 50 |
{0a..0z} |
| 51 |
{a,b\\}c,d} |
| 52 |
{a,b{c,d} |
| 53 |
{a,b}c,d} |
| 54 |
{a..F} |
| 55 |
{A..f} |
| 56 |
{a..Z} |
| 57 |
{A..z} |
| 58 |
{z..A} |
| 59 |
{Z..a} |
| 60 |
{a..F..2} |
| 61 |
{A..f..02} |
| 62 |
{a..Z..5} |
| 63 |
d{a..Z..5}b |
| 64 |
{A..z..10} |
| 65 |
{z..A..-2} |
| 66 |
{Z..a..20} |
| 67 |
{a{,b} |
| 68 |
{a},b} |
| 69 |
{x,y{,}g} |
| 70 |
{x,y{}g} |
| 71 |
{{a,b} |
| 72 |
{{a,b},c} |
| 73 |
{{a,b}c} |
| 74 |
{{a,b},} |
| 75 |
X{{a,b},}X |
| 76 |
{{a,b},}c |
| 77 |
{{a,b}.} |
| 78 |
{{a,b}} |
| 79 |
X{a..#}X |
| 80 |
# this next one is an empty string |
| 81 |
|
| 82 |
{-10..00} |
| 83 |
# Need to escape slashes in here for reasons i guess. |
| 84 |
{a,\\\\{a,b}c} |
| 85 |
{a,\\{a,b}c} |
| 86 |
a,\\{b,c} |
| 87 |
{-10.\\.00} |
| 88 |
#### bash tests/braces.tests |
| 89 |
# Note that some tests are edited out because some features of |
| 90 |
# bash are intentionally not supported in this brace expander. |
| 91 |
ff{c,b,a} |
| 92 |
f{d,e,f}g |
| 93 |
{l,n,m}xyz |
| 94 |
{abc\\,def} |
| 95 |
{abc} |
| 96 |
{x\\,y,\\{abc\\},trie} |
| 97 |
# not impementing back-ticks obviously |
| 98 |
# XXXX\\{`echo a b c | tr ' ' ','`\\} |
| 99 |
{} |
| 100 |
# We only ever have to worry about parsing a single argument, |
| 101 |
# not a command line, so spaces have a different meaning than bash. |
| 102 |
# { } |
| 103 |
} |
| 104 |
{ |
| 105 |
abcd{efgh |
| 106 |
# spaces |
| 107 |
# foo {1,2} bar |
| 108 |
# not impementing back-ticks obviously |
| 109 |
# `zecho foo {1,2} bar` |
| 110 |
# $(zecho foo {1,2} bar) |
| 111 |
# ${var} is not a variable here, like it is in bash. omit. |
| 112 |
# foo{bar,${var}.} |
| 113 |
# foo{bar,${var}} |
| 114 |
# isaacs: skip quotes for now |
| 115 |
# "${var}"{x,y} |
| 116 |
# $var{x,y} |
| 117 |
# ${var}{x,y} |
| 118 |
# new sequence brace operators |
| 119 |
{1..10} |
| 120 |
# this doesn't work yet |
| 121 |
{0..10,braces} |
| 122 |
# but this does |
| 123 |
{{0..10},braces} |
| 124 |
x{{0..10},braces}y |
| 125 |
{3..3} |
| 126 |
x{3..3}y |
| 127 |
{10..1} |
| 128 |
{10..1}y |
| 129 |
x{10..1}y |
| 130 |
{a..f} |
| 131 |
{f..a} |
| 132 |
{a..A} |
| 133 |
{A..a} |
| 134 |
{f..f} |
| 135 |
# mixes are incorrectly-formed brace expansions |
| 136 |
{1..f} |
| 137 |
{f..1} |
| 138 |
# spaces |
| 139 |
# 0{1..9} {10..20} |
| 140 |
# do negative numbers work? |
| 141 |
{-1..-10} |
| 142 |
{-20..0} |
| 143 |
# weirdly-formed brace expansions -- fixed in post-bash-3.1 |
| 144 |
a-{b{d,e}}-c |
| 145 |
a-{bdef-{g,i}-c |
| 146 |
# isaacs: skip quotes for now |
| 147 |
# {"klklkl"}{1,2,3} |
| 148 |
# isaacs: this is a valid test, though |
| 149 |
{klklkl}{1,2,3} |
| 150 |
# {"x,x"} |
| 151 |
{1..10..2} |
| 152 |
{-1..-10..2} |
| 153 |
{-1..-10..-2} |
| 154 |
{10..1..-2} |
| 155 |
{10..1..2} |
| 156 |
{1..20..2} |
| 157 |
{1..20..20} |
| 158 |
{100..0..5} |
| 159 |
{100..0..-5} |
| 160 |
{a..z} |
| 161 |
{a..z..2} |
| 162 |
{z..a..-2} |
| 163 |
# make sure brace expansion handles ints > 2**31 - 1 using intmax_t |
| 164 |
{2147483645..2147483649} |
| 165 |
# unwanted zero-padding -- fixed post-bash-4.0 |
| 166 |
{10..0..2} |
| 167 |
{10..0..-2} |
| 168 |
{-50..-0..5} |
| 169 |
# bad |
| 170 |
{1..10.f} |
| 171 |
{1..ff} |
| 172 |
{1..10..ff} |
| 173 |
{1.20..2} |
| 174 |
{1..20..f2} |
| 175 |
{1..20..2f} |
| 176 |
{1..2f..2} |
| 177 |
{1..ff..2} |
| 178 |
{1..ff} |
| 179 |
{1..f} |
| 180 |
{1..0f} |
| 181 |
{1..10f} |
| 182 |
{1..10.f} |
| 183 |
{},b}.h |
| 184 |
y{},a}x |
| 185 |
{}{},a}b |
| 186 |
{{},a}}b |
| 187 |
{}{{},a}}b |
| 188 |
{}a,b}c |
| 189 |
# Zero is an acceptable incrementer, just assume 1 |
| 190 |
{1..10..0} |
| 191 |
{1..10..-0} |
| 192 |
{a..d..0} |
| 193 |
{a..d..-0} |