Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2007 Johannes Schindelin |
| 4 | # |
| 5 | |
| 6 | test_description='our own option parser' |
| 7 | |
| 8 | . ./test-lib.sh |
| 9 | |
Giuseppe Scrivano | 9c7304e | 2010-05-17 17:34:41 +0200 | [diff] [blame] | 10 | cat > expect << EOF |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 11 | usage: test-parse-options <options> |
| 12 | |
| 13 | -b, --boolean get a boolean |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 14 | -4, --or4 bitwise-or boolean with ...0100 |
René Scharfe | 2f4b97f | 2009-05-07 21:44:17 +0200 | [diff] [blame] | 15 | --neg-or4 same as --no-or4 |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 16 | |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 17 | -i, --integer <n> get a integer |
| 18 | -j <n> get a integer, too |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 19 | --set23 set integer to 23 |
| 20 | -t <time> get timestamp of <time> |
| 21 | -L, --length <str> get length of <str> |
Michael J Gruber | 41dbcd4 | 2011-02-15 14:09:13 +0100 | [diff] [blame] | 22 | -F, --file <file> set file to <file> |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 23 | |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 24 | String options |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 25 | -s, --string <string> |
| 26 | get a string |
| 27 | --string2 <str> get another string |
Johannes Schindelin | 243e061 | 2007-11-05 13:15:21 +0000 | [diff] [blame] | 28 | --st <st> get another string (pervert ordering) |
Pierre Habouzit | 3a9f0f4 | 2008-01-26 12:26:57 +0100 | [diff] [blame] | 29 | -o <str> get another string |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 30 | --default-string set string to default |
Jeff King | c8ba163 | 2011-06-09 11:55:23 -0400 | [diff] [blame] | 31 | --list <str> add str to list |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 32 | |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 33 | Magic arguments |
Pierre Habouzit | 580d5bf | 2008-03-02 11:35:56 +0100 | [diff] [blame] | 34 | --quux means --quux |
René Scharfe | e0319ff | 2009-05-07 21:45:08 +0200 | [diff] [blame] | 35 | -NUM set integer to NUM |
René Scharfe | 51a9949 | 2009-05-07 21:45:42 +0200 | [diff] [blame] | 36 | + same as -b |
Andreas Schwab | 6bbfd1f | 2009-09-25 20:44:44 +0200 | [diff] [blame] | 37 | --ambiguous positive ambiguity |
| 38 | --no-ambiguous negative ambiguity |
Pierre Habouzit | 580d5bf | 2008-03-02 11:35:56 +0100 | [diff] [blame] | 39 | |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 40 | Standard options |
| 41 | --abbrev[=<n>] use <n> digits to display SHA-1s |
| 42 | -v, --verbose be verbose |
| 43 | -n, --dry-run dry run |
| 44 | -q, --quiet be quiet |
| 45 | |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 46 | EOF |
| 47 | |
| 48 | test_expect_success 'test help' ' |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 49 | test_must_fail test-parse-options -h > output 2> output.err && |
Giuseppe Scrivano | 9c7304e | 2010-05-17 17:34:41 +0200 | [diff] [blame] | 50 | test ! -s output.err && |
| 51 | test_cmp expect output |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 52 | ' |
| 53 | |
Giuseppe Scrivano | 9c7304e | 2010-05-17 17:34:41 +0200 | [diff] [blame] | 54 | mv expect expect.err |
| 55 | |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 56 | cat > expect << EOF |
| 57 | boolean: 2 |
| 58 | integer: 1729 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 59 | timestamp: 0 |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 60 | string: 123 |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 61 | abbrev: 7 |
| 62 | verbose: 2 |
| 63 | quiet: no |
| 64 | dry run: yes |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 65 | file: prefix/my.file |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 66 | EOF |
| 67 | |
| 68 | test_expect_success 'short options' ' |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 69 | test-parse-options -s123 -b -i 1729 -b -vv -n -F my.file \ |
| 70 | > output 2> output.err && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 71 | test_cmp expect output && |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 72 | test ! -s output.err |
| 73 | ' |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 74 | |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 75 | cat > expect << EOF |
| 76 | boolean: 2 |
| 77 | integer: 1729 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 78 | timestamp: 0 |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 79 | string: 321 |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 80 | abbrev: 10 |
| 81 | verbose: 2 |
| 82 | quiet: no |
| 83 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 84 | file: prefix/fi.le |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 85 | EOF |
| 86 | |
| 87 | test_expect_success 'long options' ' |
| 88 | test-parse-options --boolean --integer 1729 --boolean --string2=321 \ |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 89 | --verbose --verbose --no-dry-run --abbrev=10 --file fi.le\ |
René Scharfe | 6acec03 | 2011-09-28 19:44:30 +0200 | [diff] [blame] | 90 | --obsolete > output 2> output.err && |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 91 | test ! -s output.err && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 92 | test_cmp expect output |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 93 | ' |
| 94 | |
Olivier Marin | d5d745f | 2008-07-21 20:30:36 +0200 | [diff] [blame] | 95 | test_expect_success 'missing required value' ' |
| 96 | test-parse-options -s; |
| 97 | test $? = 129 && |
| 98 | test-parse-options --string; |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 99 | test $? = 129 && |
| 100 | test-parse-options --file; |
Olivier Marin | d5d745f | 2008-07-21 20:30:36 +0200 | [diff] [blame] | 101 | test $? = 129 |
| 102 | ' |
| 103 | |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 104 | cat > expect << EOF |
| 105 | boolean: 1 |
| 106 | integer: 13 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 107 | timestamp: 0 |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 108 | string: 123 |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 109 | abbrev: 7 |
| 110 | verbose: 0 |
| 111 | quiet: no |
| 112 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 113 | file: (not set) |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 114 | arg 00: a1 |
| 115 | arg 01: b1 |
| 116 | arg 02: --boolean |
| 117 | EOF |
| 118 | |
| 119 | test_expect_success 'intermingled arguments' ' |
| 120 | test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \ |
| 121 | > output 2> output.err && |
| 122 | test ! -s output.err && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 123 | test_cmp expect output |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 124 | ' |
| 125 | |
Johannes Schindelin | 7f275b9 | 2007-10-14 17:54:06 +0100 | [diff] [blame] | 126 | cat > expect << EOF |
| 127 | boolean: 0 |
| 128 | integer: 2 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 129 | timestamp: 0 |
Johannes Schindelin | 7f275b9 | 2007-10-14 17:54:06 +0100 | [diff] [blame] | 130 | string: (not set) |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 131 | abbrev: 7 |
| 132 | verbose: 0 |
| 133 | quiet: no |
| 134 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 135 | file: (not set) |
Johannes Schindelin | 7f275b9 | 2007-10-14 17:54:06 +0100 | [diff] [blame] | 136 | EOF |
| 137 | |
| 138 | test_expect_success 'unambiguously abbreviated option' ' |
| 139 | test-parse-options --int 2 --boolean --no-bo > output 2> output.err && |
| 140 | test ! -s output.err && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 141 | test_cmp expect output |
Johannes Schindelin | 7f275b9 | 2007-10-14 17:54:06 +0100 | [diff] [blame] | 142 | ' |
| 143 | |
| 144 | test_expect_success 'unambiguously abbreviated option with "="' ' |
| 145 | test-parse-options --int=2 > output 2> output.err && |
| 146 | test ! -s output.err && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 147 | test_cmp expect output |
Johannes Schindelin | 7f275b9 | 2007-10-14 17:54:06 +0100 | [diff] [blame] | 148 | ' |
| 149 | |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 150 | test_expect_success 'ambiguously abbreviated option' ' |
Johannes Schindelin | 7f275b9 | 2007-10-14 17:54:06 +0100 | [diff] [blame] | 151 | test-parse-options --strin 123; |
Junio C Hamano | 41ac414 | 2008-02-01 01:50:53 -0800 | [diff] [blame] | 152 | test $? = 129 |
Johannes Schindelin | 7f275b9 | 2007-10-14 17:54:06 +0100 | [diff] [blame] | 153 | ' |
| 154 | |
Johannes Schindelin | 243e061 | 2007-11-05 13:15:21 +0000 | [diff] [blame] | 155 | cat > expect << EOF |
| 156 | boolean: 0 |
| 157 | integer: 0 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 158 | timestamp: 0 |
Johannes Schindelin | 243e061 | 2007-11-05 13:15:21 +0000 | [diff] [blame] | 159 | string: 123 |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 160 | abbrev: 7 |
| 161 | verbose: 0 |
| 162 | quiet: no |
| 163 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 164 | file: (not set) |
Johannes Schindelin | 243e061 | 2007-11-05 13:15:21 +0000 | [diff] [blame] | 165 | EOF |
| 166 | |
| 167 | test_expect_success 'non ambiguous option (after two options it abbreviates)' ' |
| 168 | test-parse-options --st 123 > output 2> output.err && |
| 169 | test ! -s output.err && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 170 | test_cmp expect output |
Johannes Schindelin | 243e061 | 2007-11-05 13:15:21 +0000 | [diff] [blame] | 171 | ' |
| 172 | |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 173 | cat > typo.err << EOF |
Pierre Habouzit | 3a9f0f4 | 2008-01-26 12:26:57 +0100 | [diff] [blame] | 174 | error: did you mean \`--boolean\` (with two dashes ?) |
| 175 | EOF |
| 176 | |
| 177 | test_expect_success 'detect possible typos' ' |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 178 | test_must_fail test-parse-options -boolean > output 2> output.err && |
Pierre Habouzit | 3a9f0f4 | 2008-01-26 12:26:57 +0100 | [diff] [blame] | 179 | test ! -s output && |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 180 | test_cmp typo.err output.err |
Pierre Habouzit | 3a9f0f4 | 2008-01-26 12:26:57 +0100 | [diff] [blame] | 181 | ' |
| 182 | |
Pierre Habouzit | 580d5bf | 2008-03-02 11:35:56 +0100 | [diff] [blame] | 183 | cat > expect <<EOF |
| 184 | boolean: 0 |
| 185 | integer: 0 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 186 | timestamp: 0 |
Pierre Habouzit | 580d5bf | 2008-03-02 11:35:56 +0100 | [diff] [blame] | 187 | string: (not set) |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 188 | abbrev: 7 |
| 189 | verbose: 0 |
| 190 | quiet: no |
| 191 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 192 | file: (not set) |
Pierre Habouzit | 580d5bf | 2008-03-02 11:35:56 +0100 | [diff] [blame] | 193 | arg 00: --quux |
| 194 | EOF |
| 195 | |
| 196 | test_expect_success 'keep some options as arguments' ' |
| 197 | test-parse-options --quux > output 2> output.err && |
| 198 | test ! -s output.err && |
Junio C Hamano | 3af8286 | 2008-05-23 22:28:56 -0700 | [diff] [blame] | 199 | test_cmp expect output |
Pierre Habouzit | 580d5bf | 2008-03-02 11:35:56 +0100 | [diff] [blame] | 200 | ' |
| 201 | |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 202 | cat > expect <<EOF |
| 203 | boolean: 0 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 204 | integer: 0 |
| 205 | timestamp: 1 |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 206 | string: default |
| 207 | abbrev: 7 |
| 208 | verbose: 0 |
| 209 | quiet: yes |
| 210 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 211 | file: (not set) |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 212 | arg 00: foo |
| 213 | EOF |
| 214 | |
| 215 | test_expect_success 'OPT_DATE() and OPT_SET_PTR() work' ' |
| 216 | test-parse-options -t "1970-01-01 00:00:01 +0000" --default-string \ |
| 217 | foo -q > output 2> output.err && |
| 218 | test ! -s output.err && |
| 219 | test_cmp expect output |
| 220 | ' |
| 221 | |
| 222 | cat > expect <<EOF |
| 223 | Callback: "four", 0 |
| 224 | boolean: 5 |
| 225 | integer: 4 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 226 | timestamp: 0 |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 227 | string: (not set) |
| 228 | abbrev: 7 |
| 229 | verbose: 0 |
| 230 | quiet: no |
| 231 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 232 | file: (not set) |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 233 | EOF |
| 234 | |
| 235 | test_expect_success 'OPT_CALLBACK() and OPT_BIT() work' ' |
| 236 | test-parse-options --length=four -b -4 > output 2> output.err && |
| 237 | test ! -s output.err && |
| 238 | test_cmp expect output |
| 239 | ' |
| 240 | |
| 241 | cat > expect <<EOF |
| 242 | Callback: "not set", 1 |
| 243 | EOF |
| 244 | |
| 245 | test_expect_success 'OPT_CALLBACK() and callback errors work' ' |
| 246 | test_must_fail test-parse-options --no-length > output 2> output.err && |
| 247 | test_cmp expect output && |
| 248 | test_cmp expect.err output.err |
| 249 | ' |
| 250 | |
| 251 | cat > expect <<EOF |
| 252 | boolean: 1 |
| 253 | integer: 23 |
Junio C Hamano | c4aca9c | 2008-07-30 12:53:45 -0700 | [diff] [blame] | 254 | timestamp: 0 |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 255 | string: (not set) |
| 256 | abbrev: 7 |
| 257 | verbose: 0 |
| 258 | quiet: no |
| 259 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 260 | file: (not set) |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 261 | EOF |
| 262 | |
| 263 | test_expect_success 'OPT_BIT() and OPT_SET_INT() work' ' |
| 264 | test-parse-options --set23 -bbbbb --no-or4 > output 2> output.err && |
| 265 | test ! -s output.err && |
| 266 | test_cmp expect output |
| 267 | ' |
| 268 | |
René Scharfe | 2f4b97f | 2009-05-07 21:44:17 +0200 | [diff] [blame] | 269 | test_expect_success 'OPT_NEGBIT() and OPT_SET_INT() work' ' |
| 270 | test-parse-options --set23 -bbbbb --neg-or4 > output 2> output.err && |
| 271 | test ! -s output.err && |
| 272 | test_cmp expect output |
| 273 | ' |
| 274 | |
| 275 | cat > expect <<EOF |
| 276 | boolean: 6 |
| 277 | integer: 0 |
| 278 | timestamp: 0 |
| 279 | string: (not set) |
| 280 | abbrev: 7 |
| 281 | verbose: 0 |
| 282 | quiet: no |
| 283 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 284 | file: (not set) |
René Scharfe | 2f4b97f | 2009-05-07 21:44:17 +0200 | [diff] [blame] | 285 | EOF |
| 286 | |
| 287 | test_expect_success 'OPT_BIT() works' ' |
| 288 | test-parse-options -bb --or4 > output 2> output.err && |
| 289 | test ! -s output.err && |
| 290 | test_cmp expect output |
| 291 | ' |
| 292 | |
| 293 | test_expect_success 'OPT_NEGBIT() works' ' |
| 294 | test-parse-options -bb --no-neg-or4 > output 2> output.err && |
| 295 | test ! -s output.err && |
| 296 | test_cmp expect output |
| 297 | ' |
Stephan Beyer | 010a2da | 2008-06-22 17:04:26 +0200 | [diff] [blame] | 298 | |
René Scharfe | 51a9949 | 2009-05-07 21:45:42 +0200 | [diff] [blame] | 299 | test_expect_success 'OPT_BOOLEAN() with PARSE_OPT_NODASH works' ' |
| 300 | test-parse-options + + + + + + > output 2> output.err && |
| 301 | test ! -s output.err && |
| 302 | test_cmp expect output |
| 303 | ' |
| 304 | |
René Scharfe | e0319ff | 2009-05-07 21:45:08 +0200 | [diff] [blame] | 305 | cat > expect <<EOF |
| 306 | boolean: 0 |
| 307 | integer: 12345 |
| 308 | timestamp: 0 |
| 309 | string: (not set) |
| 310 | abbrev: 7 |
| 311 | verbose: 0 |
| 312 | quiet: no |
| 313 | dry run: no |
Stephen Boyd | df217ed | 2009-05-23 11:53:13 -0700 | [diff] [blame] | 314 | file: (not set) |
René Scharfe | e0319ff | 2009-05-07 21:45:08 +0200 | [diff] [blame] | 315 | EOF |
| 316 | |
| 317 | test_expect_success 'OPT_NUMBER_CALLBACK() works' ' |
| 318 | test-parse-options -12345 > output 2> output.err && |
| 319 | test ! -s output.err && |
| 320 | test_cmp expect output |
| 321 | ' |
| 322 | |
Andreas Schwab | 6bbfd1f | 2009-09-25 20:44:44 +0200 | [diff] [blame] | 323 | cat >expect <<EOF |
| 324 | boolean: 0 |
| 325 | integer: 0 |
| 326 | timestamp: 0 |
| 327 | string: (not set) |
| 328 | abbrev: 7 |
| 329 | verbose: 0 |
| 330 | quiet: no |
| 331 | dry run: no |
| 332 | file: (not set) |
| 333 | EOF |
| 334 | |
| 335 | test_expect_success 'negation of OPT_NONEG flags is not ambiguous' ' |
| 336 | test-parse-options --no-ambig >output 2>output.err && |
| 337 | test ! -s output.err && |
| 338 | test_cmp expect output |
| 339 | ' |
| 340 | |
Jeff King | c8ba163 | 2011-06-09 11:55:23 -0400 | [diff] [blame] | 341 | cat >>expect <<'EOF' |
| 342 | list: foo |
| 343 | list: bar |
| 344 | list: baz |
| 345 | EOF |
| 346 | test_expect_success '--list keeps list of strings' ' |
| 347 | test-parse-options --list foo --list=bar --list=baz >output && |
| 348 | test_cmp expect output |
| 349 | ' |
| 350 | |
| 351 | test_expect_success '--no-list resets list' ' |
| 352 | test-parse-options --list=other --list=irrelevant --list=options \ |
| 353 | --no-list --list=foo --list=bar --list=baz >output && |
| 354 | test_cmp expect output |
| 355 | ' |
| 356 | |
Johannes Schindelin | beb4743 | 2007-10-13 17:34:45 +0100 | [diff] [blame] | 357 | test_done |