@@ -416,14 +416,48 @@ private function doCheckSetOptAndSetArg($fs): void
416416 $ this ->assertSame ("flag argument 'not-exist-arg' is undefined " , $ e ->getMessage ());
417417 }
418418
419- public function testParse_opt_isKV (): void
419+ public function testParse_arrayArg (): void
420420 {
421421 foreach ($ this ->createParsers () as $ fs ) {
422- $ this ->doTestParse_opt_isKV ($ fs );
422+ $ this ->doTestParse_arrayArg ($ fs );
423423 }
424424 }
425425
426- public function doTestParse_opt_isKV (FlagsParser $ fs ): void
426+ public function doTestParse_arrayArg (FlagsParser $ fs ): void
427+ {
428+ $ fs ->addOptsByRules ([
429+ 'env, e ' => [
430+ 'type ' => FlagType::STRING ,
431+ 'required ' => true ,
432+ ],
433+ ]);
434+ $ fs ->addArgByRule ('files ' , 'array;a array arg ' );
435+
436+ $ flags = ['-e ' , 'dev ' , 'abc ' ];
437+ $ fs ->parse ($ flags );
438+
439+ $ this ->assertNotEmpty ($ fs ->getOpts ());
440+ $ this ->assertNotEmpty ($ fs ->getArgs ());
441+ $ this ->assertEquals (['abc ' ], $ fs ->getArg ('files ' ));
442+ $ fs ->resetResults ();
443+
444+ $ flags = ['-e ' , 'dev ' , 'abc ' , 'def ' ];
445+ $ fs ->parse ($ flags );
446+
447+ $ this ->assertNotEmpty ($ fs ->getOpts ());
448+ $ this ->assertNotEmpty ($ fs ->getArgs ());
449+ $ this ->assertEquals (['abc ' , 'def ' ], $ fs ->getArg ('files ' ));
450+ $ fs ->resetResults ();
451+ }
452+
453+ public function testParse_optValueIsKV (): void
454+ {
455+ foreach ($ this ->createParsers () as $ fs ) {
456+ $ this ->doTestParse_optValueIsKV ($ fs );
457+ }
458+ }
459+
460+ public function doTestParse_optValueIsKV (FlagsParser $ fs ): void
427461 {
428462 $ fs ->addOptsByRules ([
429463 'env, e ' => [
0 commit comments