diff options
author | Nathan Gass | 2012-03-22 18:18:42 +0000 |
---|---|---|
committer | Nathan Gass | 2012-03-22 18:18:42 +0000 |
commit | d59a4921188753dbe4c0161081755a28112c3ef6 (patch) | |
tree | 81496414d988f37f1db9d92c9750d888ffa13746 /devel-utf8/tests/exec.t | |
parent | ca11771e8fad5fef96615df4c44e04b8fb60ac31 (diff) | |
download | itools-d59a4921188753dbe4c0161081755a28112c3ef6.tar.gz itools-d59a4921188753dbe4c0161081755a28112c3ef6.tar.bz2 itools-d59a4921188753dbe4c0161081755a28112c3ef6.zip |
Branch itools/devel-utf8 created
Diffstat (limited to 'devel-utf8/tests/exec.t')
-rwxr-xr-x | devel-utf8/tests/exec.t | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/devel-utf8/tests/exec.t b/devel-utf8/tests/exec.t new file mode 100755 index 0000000..689bd26 --- /dev/null +++ b/devel-utf8/tests/exec.t @@ -0,0 +1,23 @@ +#!/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::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"); + +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"); |