summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/getopt.t5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/getopt.t b/test/getopt.t
index e4c98ed..e74e925 100755
--- a/test/getopt.t
+++ b/test/getopt.t
@@ -7,6 +7,7 @@ $GLOBALS['usage'] = "Usage: doesnotexist.php [OPTIONS] POSITIONAL
Some help to a not existing program
-h,--help the help argument
-a,--argument=ARG the arg argument
+ -d,--default=ARG an argument with default [defäult]
-0,--zero testworthy shortarg
";
@@ -18,13 +19,13 @@ function getopt_ok($argv, $exp, $name)
}
foreach (["" => "blah gnaber", " (umlaute)" => "pre üäpost"] as $variant => $testarg) {
- $exp = ['args' => [], 'positional' => $testarg, 'argument' => $testarg];
+ $exp = ['args' => [], 'positional' => $testarg, 'argument' => $testarg, 'default' => 'defäult'];
getopt_ok([$testarg, '-a', $testarg], $exp, "Short version" . $variant);
getopt_ok([$testarg, '--argument', $testarg], $exp, "Long version with space" . $variant);
getopt_ok([$testarg, "--argument=$testarg"], $exp, "Long version with equal" . $variant);
}
-$exp = ['args' => [], 'positional' => 'posarg', 'zero' => true];
+$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');
getopt_ok(['posarg', '-0', 'vararg'], ['args' => ['vararg']] + $exp, "additional value after short argument -0");