summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/exec.t52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/exec.t b/tests/exec.t
index 6418716..4702681 100755
--- a/tests/exec.t
+++ b/tests/exec.t
@@ -10,6 +10,58 @@ is(it::shell_command("echo {arg}", array('arg' => 'gna07,-:blah')), "echo gna07,
is(it::shell_command("echo {arg}", array('arg' => '2>&1')), "echo '2>&1'", "quote arguments with dangerous characters");
is(it::shell_command("echo {arg}", array('arg' => '')), "echo ''", "quote empty arguments");
+
+is(
+ it::shell_command("echo {-opts}", array('-opts' => array('--longopt' => true))),
+ "echo --longopt",
+ "options argument with long option"
+);
+is(
+ it::shell_command("echo {-opts}", array('-opts' => array('-onedash' => true))),
+ "echo -onedash",
+ "... with long option but only one dash"
+);
+is(
+ it::shell_command("echo {-opts}", array('-opts' => array('-s' => true))),
+ "echo -s",
+ "... with short option"
+);
+is(
+ it::shell_command("echo {-opts}", array('-opts' => array('--longopt' => 'val'))),
+ "echo --longopt val",
+ "... with long option with value"
+);
+is(
+ it::shell_command("echo {-opts}", array('-opts' => array('-onedash' => 'val'))),
+ "echo -onedash val",
+ "... with long option but only one dash and with value"
+);
+is(
+ it::shell_command("echo {-opts}", array('-opts' => array('-s' => 'val'))),
+ "echo -s val",
+ "... with short option with value"
+);
+is(
+ it::shell_command("echo {-opts}", array('-opts' => array('--longopt' => false))),
+ "echo ",
+ "... with disabled long option"
+);
+is(
+ it::shell_command("echo {-opts}", array('-opts' => array('-s' => false))),
+ "echo ",
+ "... with disabled short option"
+);
+is(
+ it::shell_command("echo {--opts}", array('--opts' => array('longopt' => true))),
+ "echo --longopt",
+ "... long option without dashes for --opts"
+);
+is(
+ it::shell_command("echo {--opts}", array('--opts' => array('s' => true))),
+ "echo -s",
+ "... short option without dashes for --opts"
+);
+
foreach (array("", "C", "de_CH", "de_CH.utf8") as $locale) {
setlocale(LC_ALL, $locale);
$arg = "preĆ¼post";