0
0
mirror of https://github.com/phpv8/v8js.git synced 2025-01-03 10:21:51 +00:00

Revert "Create unicode.php"

This reverts commit 3559f1797e.
This commit is contained in:
Stefan Siegl 2017-09-25 15:01:37 +02:00
parent 33b3ff5e1f
commit ef90ad7065
No known key found for this signature in database
GPG Key ID: 51575950154839CD

View File

@ -1,20 +1,15 @@
--TEST --TEST
Test V8::executeString() : Check if imported code works with some unicode symbols Test V8::executeString() : Check if imported code works with umlauts
--SKIPIF-- --SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php <?php
# check if v8js was compiled with snapshot support
define('V8_WITH_SNAPSHOT', method_exists("V8Js", "createSnapshot"));
# maybe more characters (e.g. from http://www.ltg.ed.ac.uk/~richard/unicode-sample.html?) # maybe more characters (e.g. from http://www.ltg.ed.ac.uk/~richard/unicode-sample.html?)
$unicode = 'äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃'; $unicode = 'äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃';
# insert unicode via snapshot # insert unicode via snapshot
if (V8_WITH_SNAPSHOT) { $snapshot = V8Js::createSnapshot("var snapshot = {unicode: '" . $unicode . "'}");
$snapshot = V8Js::createSnapshot("var snapshot = {unicode: '" . $unicode . "'}");
} else {
# argument is only checked for type and further ignored
$snapshot = '';
}
# start V8Js # start V8Js
$jscript = new V8Js('php', array(), array(), true, $snapshot); $jscript = new V8Js('php', array(), array(), true, $snapshot);
@ -27,12 +22,7 @@ $jscript->executeString("var execStr = {unicode: '" . $unicode . "'}");
# return to php # return to php
$jscript->executeString("values = {}"); $jscript->executeString("values = {}");
if (V8_WITH_SNAPSHOT) { $jscript->executeString("values['snapshot'] = snapshot.unicode");
$jscript->executeString("values['snapshot'] = snapshot.unicode");
} else {
# shim this test
$jscript->executeString("values['snapshot'] = '" . $unicode . "'");
}
$jscript->executeString("values['php'] = php.unicode"); $jscript->executeString("values['php'] = php.unicode");
$jscript->executeString("values['execStr'] = execStr.unicode"); $jscript->executeString("values['execStr'] = execStr.unicode");
$values = $jscript->executeString("values"); $values = $jscript->executeString("values");
@ -41,8 +31,8 @@ echo "snapshot: $values->snapshot\n";
echo "php : $values->php\n"; echo "php : $values->php\n";
echo "execStr : $values->execStr\n"; echo "execStr : $values->execStr\n";
?> ?>
===EOF=== ===EOF
--EXPECT-- --EXPECTF--
snapshot: äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█ snapshot: äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█
php : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█ php : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█
execStr : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█ execStr : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█