summaryrefslogtreecommitdiff
path: root/tests/exec.t
diff options
context:
space:
mode:
authorUrban Müller2018-06-21 16:42:32 +0200
committerUrban Müller2018-06-21 16:43:32 +0200
commit3dabbbd5325c9fad9582cd44b1da68dece78eaa0 (patch)
tree92d951b948f0e01dc6b7ae3f11b9c03034edb69a /tests/exec.t
parent455b15f7a850a58ef667ad170732769043eb1522 (diff)
downloaditools-3dabbbd5325c9fad9582cd44b1da68dece78eaa0.tar.gz
itools-3dabbbd5325c9fad9582cd44b1da68dece78eaa0.tar.bz2
itools-3dabbbd5325c9fad9582cd44b1da68dece78eaa0.zip
no reason for different naming
Diffstat (limited to 'tests/exec.t')
-rwxr-xr-xtests/exec.t93
1 files changed, 0 insertions, 93 deletions
diff --git a/tests/exec.t b/tests/exec.t
deleted file mode 100755
index c155c88..0000000
--- a/tests/exec.t
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/www/server/bin/php -qC
-<?php
-
-# Tests for getopt in it.class
-
-is(it::exec("echo gna"), "gna\n", "basic exec");
-is(it::exec("echo {arg}", array('arg' => 'gna')), "gna\n", "exec with argument");
-is(it::exec("echo {0}", 'gna'), "gna\n", "exec with positional argument");
-is(it::shell_command("echo {arg}", array('arg' => 'gna07,-:blah')), "echo gna07,-:blah", "don't quote arguments with only whitelistes characters");
-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"
-);
-is(
- it::shell_command("echo {-opts}", array('-opts' => array('s' => true))),
- "echo -s",
- "... short option without dashes"
-);
-
-foreach (array("", "C", "de_CH", "de_CH.utf8") as $locale) {
- setlocale(LC_ALL, $locale);
- $arg = "preüpost";
- if (it::match('utf8', $locale))
- $arg = utf8_encode($arg);
- is(it::exec("echo " . $arg), $arg . "\n", "exec with umlaut (locale '$locale')");
- is(it::exec("echo {arg}", array('arg' => $arg)), $arg . "\n", "exec with argument and umlaut (locale '$locale')");
-}
-
-is(it::_exec_quotevalue(""), "''", "empty arg needs quotes");
-is(it::_exec_quotevalue("*"), "'*'", "special chars need quotes");
-is(it::_exec_quotevalue("Aabcdef0123456789"), "Aabcdef0123456789", "simple case. tel:debug_getdata needs unquoted vals");
-
-is(it::system('exit 0'), 0, 'return exit code 0');
-is(it::system('exit 1'), 1, 'return exit code 1');
-is(it::system('exit -1'), 255, 'return exit code unsigned');
-
-@unlink('/tmp/it_system_test');
-it::system('touch /tmp/it_system_test');
-ok(file_exists('/tmp/it_system_test'), 'shell command gets executed');
-
-@unlink('/tmp/it_system_test');
-it::system('touch {path}', array('path' => '/tmp/it_system_test'));
-ok(file_exists('/tmp/it_system_test'), 'shell command with argument');
-
-@unlink('/tmp/it_system_test');
-it::system('touch {0}', '/tmp/it_system_test');
-ok(file_exists('/tmp/it_system_test'), 'shell command with positional argument');
-@unlink('/tmp/it_system_test');