From d5a1eeaebeb6af8f2eef494b260a6cb742013fda Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Tue, 11 Nov 2008 16:25:21 +0000 Subject: some latin1 tests, debug it::exec --- tests/exec.t | 20 ++++++++++++++++++++ tests/getopt.t | 9 +++++---- 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100755 tests/exec.t (limited to 'tests') diff --git a/tests/exec.t b/tests/exec.t new file mode 100755 index 0000000..5e021cb --- /dev/null +++ b/tests/exec.t @@ -0,0 +1,20 @@ +#!/www/server/bin/php -qC + 'gna'), "gna\n", "exec with argument"); + +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}", 'arg' => $arg), $arg . "\n", "exec with argument and umlaut (locale '$locale')"); +} + + diff --git a/tests/getopt.t b/tests/getopt.t index 2fbe322..54a5604 100755 --- a/tests/getopt.t +++ b/tests/getopt.t @@ -18,7 +18,8 @@ function getopt_ok($argv, $exp, $name) return is($got['argument'], $exp, $name); } -$testarg = "blah gnaber"; -getopt_ok(array('-a', $testarg), $testarg, "Short version"); -getopt_ok(array('--argument', $testarg), $testarg, "Long version with space"); -getopt_ok(array("--argument=$testarg"), $testarg, "Long version with equal"); +foreach (array("" => "blah gnaber", " (umlaute)" => "pre üäpost") as $variant => $testarg) { + getopt_ok(array('-a', $testarg), $testarg, "Short version" . $variant); + getopt_ok(array('--argument', $testarg), $testarg, "Long version with space" . $variant); + getopt_ok(array("--argument=$testarg"), $testarg, "Long version with equal" . $variant); +} -- cgit v1.2.3