Skip to content

Commit 33b3ff5

Browse files
committed
Revert "Renamed to unicode.phpt"
This reverts commit 202f0be.
1 parent eba01e1 commit 33b3ff5

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed
Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,49 @@
11
--TEST
22
Test V8::executeString() : Check if imported code works with some unicode symbols
33
--SKIPIF--
4-
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5-
--FILE--
64
<?php
7-
# check if snapshots are supported
5+
# check if v8js was compiled with snapshot support
86
define('V8_WITH_SNAPSHOT', method_exists("V8Js", "createSnapshot"));
97

108
# maybe more characters (e.g. from http://www.ltg.ed.ac.uk/~richard/unicode-sample.html?)
119
$unicode = 'äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃';
12-
$moduleFileBase = 'test';
1310

1411
# insert unicode via snapshot
1512
if (V8_WITH_SNAPSHOT) {
1613
$snapshot = V8Js::createSnapshot("var snapshot = {unicode: '" . $unicode . "'}");
1714
} else {
15+
# argument is only checked for type and further ignored
1816
$snapshot = '';
1917
}
2018

2119
# start V8Js
2220
$jscript = new V8Js('php', array(), array(), true, $snapshot);
23-
$jscript->setModuleLoader(function ($path) {
24-
return file_get_contents($path . ".js");
25-
});
2621

2722
# insert unicode via php var
2823
$jscript->unicode = $unicode;
2924

3025
# insert unicode via executeString
3126
$jscript->executeString("var execStr = {unicode: '" . $unicode . "'}");
3227

33-
# insert unicode via commonJS module
34-
file_put_contents("./$moduleFileBase.js", "module.exports = {unicode: '$unicode'}");
35-
$jscript->executeString("var module = require('./$moduleFileBase')");
36-
3728
# return to php
3829
$jscript->executeString("values = {}");
3930
if (V8_WITH_SNAPSHOT) {
4031
$jscript->executeString("values['snapshot'] = snapshot.unicode");
4132
} else {
42-
// if snapshots are not compiled shim this test
33+
# shim this test
4334
$jscript->executeString("values['snapshot'] = '" . $unicode . "'");
4435
}
4536
$jscript->executeString("values['php'] = php.unicode");
4637
$jscript->executeString("values['execStr'] = execStr.unicode");
47-
$jscript->executeString("values['module'] = module.unicode");
4838
$values = $jscript->executeString("values");
4939

5040
echo "snapshot: $values->snapshot\n";
5141
echo "php : $values->php\n";
5242
echo "execStr : $values->execStr\n";
53-
echo "module : $values->module\n";
5443
?>
44+
===EOF===
5545
--EXPECT--
5646
snapshot: äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃
5747
php : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃
5848
execStr : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█    ㌀ ㌁ ㌂ ㌃
59-
--CLEAN--
60-
<?php
61-
unlink("./$moduleFileBase.js");
62-
?>
49+
===EOF===

0 commit comments

Comments
 (0)