summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/getopt.t3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/getopt.t b/test/getopt.t
index 77e52ae..380d0fd 100755
--- a/test/getopt.t
+++ b/test/getopt.t
@@ -9,6 +9,7 @@ $GLOBALS['usage'] = "Usage: doesnotexist.php [OPTIONS] POSITIONAL [VARARGS]
-a,--argument=ARG the arg argument
-d,--default=ARG an argument with default [defäult]
-0,--zero testworthy shortarg
+ -c,--comma option with comma and, -minus in the description
";
function getopt_ok($argv, $exp, $name)
@@ -26,6 +27,7 @@ foreach (["" => "blah gnaber", " (umlaute)" => "pre üäpost"] as $variant => $t
getopt_ok([$testarg, "--argument=$testarg"], $exp, "Long version with equal" . $variant);
}
+getopt_ok(['posargs', '-c'], ['args' => [], 'positional' => 'posargs', 'comma' => true, 'default' => 'defäult'], "comma and minus in description doesn't break shortopt");
$exp = ['args' => [], 'positional' => 'posarg', 'zero' => true, 'default' => 'defäult'];
getopt_ok(['posarg', '-0'], $exp, 'short argument -0 without value');
getopt_ok(['posarg', '--zero'], $exp, 'long argument --zero without value');
@@ -33,6 +35,7 @@ getopt_ok(['posarg', '-0', 'vararg'], ['args' => ['vararg']] + $exp, "additional
getopt_ok(['posarg', '--zero', 'vararg'], ['args' => ['vararg']] + $exp, "additional value after long argument --zero");
fclose(STDERR);
+getopt_ok(['posargs', '-m'], false, "comma and minus in description doesn't break shortopt 2");
getopt_ok(['posarg', '--unknown'], false, "Unknown long named argument fails");
getopt_ok(['posarg', '-u'], false, "Unknown short named argument fails");
getopt_ok([], false, "Missing positional argument fails");