Skip to content

Commit

Permalink
Merge pull request #60 from cxj/testCluster
Browse files Browse the repository at this point in the history
Add test for concatenated short options with an optional argument.
  • Loading branch information
harikt committed Feb 7, 2022
2 parents daf6fc5 + fb5b70f commit ca793e5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/Context/GetoptParserTest.php
Expand Up @@ -311,6 +311,23 @@ public function testParse_shortClusterRequired()
$this->assertSame($expect, $actual->getMessage());
}

public function testParse_shortClusterOptional()
{
$options = array('f', 'z', 'b::');
$this->getopt_parser->setOptions($options);

$result = $this->getopt_parser->parseInput(array('-fzb', 'foo_arg'));
$this->assertTrue($result);

$expect = array(
'-f' => true,
'-z' => true,
'-b' => 'foo_arg',
);
$actual = $this->getopt_parser->getValues();
$this->assertSame($expect, $actual);
}

public function testParseAndGet()
{
$this->getopt_parser->setOptions(array('#foo', 'foo-bar:', '#bar', 'b', '#baz?', 'z::'));
Expand Down

0 comments on commit ca793e5

Please sign in to comment.