@@ -3,8 +3,6 @@ import 'package:test/test.dart';
33
44import 'utils.dart' ;
55
6- const notImplemmentedYet = 'not implemented yet' ;
7-
86/// The goal for the tests in this file is to guarantee the general working of
97/// the completion suggestions given a shell request
108void main () {
@@ -49,7 +47,6 @@ void main() {
4947 '--rootFlag' : r'A flag\: in the root command' ,
5048 '--rootOption' : null ,
5149 },
52- skip: notImplemmentedYet,
5350 );
5451
5552 testCompletion (
@@ -59,7 +56,6 @@ void main() {
5956 '--rootFlag' : r'A flag\: in the root command' ,
6057 '--rootOption' : null ,
6158 },
62- skip: notImplemmentedYet,
6359 );
6460
6561 testCompletion (
@@ -69,7 +65,15 @@ void main() {
6965 '--rootFlag' : r'A flag\: in the root command' ,
7066 '--rootOption' : null ,
7167 },
72- skip: notImplemmentedYet,
68+ );
69+
70+ testCompletion (
71+ 'partially written name with preceding dash' ,
72+ forLine: 'example_cli - --r' ,
73+ suggests: {
74+ '--rootFlag' : r'A flag\: in the root command' ,
75+ '--rootOption' : null ,
76+ },
7377 );
7478 });
7579
@@ -81,22 +85,19 @@ void main() {
8185 '-h' : 'Print this usage information.' ,
8286 '-f' : r'A flag\: in the root command' ,
8387 },
84- skip: notImplemmentedYet,
8588 );
8689 });
8790
8891 testCompletion (
8992 'totally written option' ,
9093 forLine: 'example_cli --rootflag' ,
9194 suggests: noSuggestions,
92- skip: notImplemmentedYet,
9395 );
9496
9597 testCompletion (
9698 'totally written option (abbr)' ,
9799 forLine: 'example_cli -f' ,
98100 suggests: noSuggestions,
99- skip: notImplemmentedYet,
100101 );
101102 });
102103
@@ -146,18 +147,6 @@ void main() {
146147 },
147148 );
148149 });
149-
150- group (
151- 'invalid command structure' ,
152- () {
153- testCompletion (
154- 'suggests nothing when there is an unkown command' ,
155- forLine: 'example_cli unknown some' ,
156- suggests: noSuggestions,
157- skip: notImplemmentedYet,
158- );
159- },
160- );
161150 });
162151 });
163152
@@ -202,10 +191,17 @@ void main() {
202191 suggests: allOptionsInThisLevel,
203192 );
204193
194+ testCompletion (
195+ 'flags in between' ,
196+ forLine: 'example_cli -f some_command' ,
197+ suggests: allOptionsInThisLevel,
198+ );
199+
205200 testCompletion (
206201 'options in between' ,
207202 forLine: 'example_cli -f --rootOption yay some_command' ,
208203 suggests: allOptionsInThisLevel,
204+ tags: 'known-issues' ,
209205 );
210206
211207 testCompletion (
@@ -234,14 +230,12 @@ void main() {
234230 'just double dash' ,
235231 forLine: 'example_cli some_command --' ,
236232 suggests: allOptionsInThisLevel,
237- skip: notImplemmentedYet,
238233 );
239234
240235 testCompletion (
241236 'just double dash with lots of spaces in between' ,
242237 forLine: 'example_cli some_command --' ,
243238 suggests: allOptionsInThisLevel,
244- skip: notImplemmentedYet,
245239 );
246240
247241 testCompletion (
@@ -251,7 +245,6 @@ void main() {
251245 '--multi-d' : 'An discrete option that can be passed multiple times ' ,
252246 '--multi-c' : 'An continuous option that can be passed multiple times' ,
253247 },
254- skip: notImplemmentedYet,
255248 );
256249
257250 testCompletion (
@@ -260,7 +253,6 @@ void main() {
260253 suggests: {
261254 '--discrete' : 'A discrete option with "allowed" values (mandatory)' ,
262255 },
263- skip: notImplemmentedYet,
264256 );
265257 });
266258
@@ -271,7 +263,6 @@ void main() {
271263 suggests: {
272264 '--allowed' : 'A discrete option with "allowed" values (mandatory)' ,
273265 },
274- skip: notImplemmentedYet,
275266 );
276267
277268 testCompletion (
@@ -281,7 +272,6 @@ void main() {
281272 '--defined-values' :
282273 'A discrete option with "allowed" values (mandatory)' ,
283274 },
284- skip: notImplemmentedYet,
285275 );
286276 });
287277
@@ -290,7 +280,6 @@ void main() {
290280 'just dash' ,
291281 forLine: 'example_cli some_command -' ,
292282 suggests: allAbbreviationssInThisLevel,
293- skip: notImplemmentedYet,
294283 );
295284 });
296285
@@ -299,14 +288,12 @@ void main() {
299288 'do not complete hidden options' ,
300289 forLine: 'example_cli some_command --hidd' ,
301290 suggests: noSuggestions,
302- skip: notImplemmentedYet,
303291 );
304292
305293 testCompletion (
306294 'do not complete ubnknown options' ,
307295 forLine: 'example_cli some_command --invalid' ,
308296 suggests: noSuggestions,
309- skip: notImplemmentedYet,
310297 );
311298 });
312299
@@ -320,7 +307,6 @@ void main() {
320307 'bar' : 'bar help' ,
321308 'faa' : 'faa help' ,
322309 },
323- skip: notImplemmentedYet,
324310 );
325311
326312 testCompletion (
@@ -330,14 +316,12 @@ void main() {
330316 'foo' : 'foo help' ,
331317 'faa' : 'faa help' ,
332318 },
333- skip: notImplemmentedYet,
334319 );
335320
336321 testCompletion (
337322 '**do not** suggest possible options when using equals/quote syntax' ,
338323 forLine: 'example_cli some_command --discrete="' ,
339324 suggests: noSuggestions,
340- skip: notImplemmentedYet,
341325 );
342326 });
343327
@@ -350,7 +334,6 @@ void main() {
350334 'bar' : 'bar help' ,
351335 'faa' : 'faa help' ,
352336 },
353- skip: notImplemmentedYet,
354337 );
355338
356339 testCompletion (
@@ -361,7 +344,6 @@ void main() {
361344 'bar' : 'bar help' ,
362345 'faa' : 'faa help' ,
363346 },
364- skip: notImplemmentedYet,
365347 );
366348 });
367349
@@ -370,21 +352,18 @@ void main() {
370352 'suggest nothing when previous option is continuous' ,
371353 forLine: 'example_cli some_command --continuous ' ,
372354 suggests: noSuggestions,
373- skip: notImplemmentedYet,
374355 );
375356
376357 testCompletion (
377358 'suggest all options when previous option is continuous with a value' ,
378359 forLine: 'example_cli some_command --continuous="yeahoo" ' ,
379360 suggests: allOptionsInThisLevel,
380- skip: notImplemmentedYet,
381361 );
382362
383363 testCompletion (
384364 'suggest all options when previous option is continuous with a value' ,
385365 forLine: 'example_cli some_command --continuous yeahoo ' ,
386366 suggests: allOptionsInThisLevel,
387- skip: notImplemmentedYet,
388367 );
389368 });
390369
@@ -393,14 +372,12 @@ void main() {
393372 'suggest all options when a flag was declared' ,
394373 forLine: 'example_cli some_command --flag ' ,
395374 suggests: allOptionsInThisLevel,
396- skip: notImplemmentedYet,
397375 );
398376
399377 testCompletion (
400378 'suggest all options when a negated flag was declared' ,
401379 forLine: 'example_cli some_command --no-flag ' ,
402380 suggests: allOptionsInThisLevel,
403- skip: notImplemmentedYet,
404381 );
405382 });
406383 });
@@ -409,23 +386,74 @@ void main() {
409386 group ('discrete' , () {
410387 testCompletion (
411388 'suggest possible options' ,
389+ forLine: 'example_cli some_command -d ' ,
390+ suggests: {
391+ 'foo' : 'foo help' ,
392+ 'bar' : 'bar help' ,
393+ 'faa' : 'faa help' ,
394+ },
395+ );
396+
397+ testCompletion (
398+ 'suggest possible options in a joined form' ,
412399 forLine: 'example_cli some_command -d' ,
413400 suggests: {
414401 '-dfoo' : 'foo help' ,
415402 '-dbar' : 'bar help' ,
416403 '-dfaa' : 'faa help' ,
417404 },
418- skip: notImplemmentedYet,
419405 );
420406
421407 testCompletion (
422408 'suggest matching options' ,
409+ forLine: 'example_cli some_command -d f' ,
410+ suggests: {
411+ 'foo' : 'foo help' ,
412+ 'faa' : 'faa help' ,
413+ },
414+ );
415+
416+ testCompletion (
417+ 'suggest matching options in a joined form' ,
423418 forLine: 'example_cli some_command -df' ,
424419 suggests: {
425420 '-dfoo' : 'foo help' ,
426421 '-dfaa' : 'faa help' ,
427422 },
428- skip: notImplemmentedYet,
423+ );
424+ });
425+
426+ group ('continuous' , () {
427+ testCompletion (
428+ 'suggest nothing when previous option is continuous' ,
429+ forLine: 'example_cli some_command -n ' ,
430+ suggests: {},
431+ );
432+
433+ testCompletion (
434+ 'suggest nothing when continuous option is joined' ,
435+ forLine: 'example_cli some_command -n' ,
436+ suggests: {},
437+ );
438+
439+ testCompletion (
440+ 'suggest nothing when typing its value' ,
441+ forLine: 'example_cli some_command -n something' ,
442+ suggests: {},
443+ );
444+
445+ testCompletion (
446+ 'suggest nothing when joining abbreviations' ,
447+ forLine: 'example_cli some_command -dn' ,
448+ suggests: {},
449+ );
450+ });
451+
452+ group ('flag' , () {
453+ testCompletion (
454+ 'suggest all options when a flag was declared' ,
455+ forLine: 'example_cli some_command -f ' ,
456+ suggests: allOptionsInThisLevel,
429457 );
430458 });
431459 });
@@ -435,13 +463,12 @@ void main() {
435463 'just dash with a space after' ,
436464 forLine: 'example_cli some_command - ' ,
437465 suggests: allOptionsInThisLevel,
438- skip: notImplemmentedYet,
439466 );
440467 });
441468
442469 group (
443- skip: notImplemmentedYet,
444470 'repeating options' ,
471+ tags: 'known-issues' ,
445472 () {
446473 group ('non multi options' , () {});
447474
@@ -482,21 +509,18 @@ void main() {
482509 'basic usage' ,
483510 forLine: 'example_cli some_other_command subcommand' ,
484511 suggests: allOptionsInThisLevel,
485- skip: notImplemmentedYet,
486512 );
487513
488514 testCompletion (
489515 'basic usage with lots of spaces in between' ,
490516 forLine: 'example_cli some_other_command subcommand' ,
491517 suggests: allOptionsInThisLevel,
492- skip: notImplemmentedYet,
493518 );
494519
495520 testCompletion (
496521 'basic usage with args in between' ,
497522 forLine: 'example_cli -f some_other_command subcommand' ,
498523 suggests: allOptionsInThisLevel,
499- skip: notImplemmentedYet,
500524 );
501525 });
502526
0 commit comments