mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-09 23:08:41 +00:00
bd7d649d90
Conflicts: php_v8js_macros.h
47 lines
950 B
PHP
47 lines
950 B
PHP
--TEST--
|
|
Test V8::compileString() : Check compiled script isolate processing
|
|
--SKIPIF--
|
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$js = <<<'EOT'
|
|
var a = { 'hello' : 'world' }; a;
|
|
EOT;
|
|
|
|
$js2 = <<<'EOT'
|
|
var a = { 'foo' : 'bar' }; a;
|
|
EOT;
|
|
|
|
$v8 = new V8Js();
|
|
$v8two = new V8Js();
|
|
|
|
try {
|
|
$script_a = $v8->compileString($js, 'a.js');
|
|
var_dump($script_a);
|
|
$script_b = $v8two->compileString($js2, 'b.js');
|
|
var_dump($script_b);
|
|
var_dump($v8->executeScript($script_a));
|
|
var_dump($v8->executeScript($script_b));
|
|
var_dump($v8->executeScript($script_a));
|
|
} catch (V8JsScriptException $e) {
|
|
var_dump($e);
|
|
}
|
|
?>
|
|
===EOF===
|
|
--EXPECTF--
|
|
resource(%d) of type (V8Js script)
|
|
resource(%d) of type (V8Js script)
|
|
object(V8Object)#%d (1) {
|
|
["hello"]=>
|
|
string(5) "world"
|
|
}
|
|
|
|
Warning: Script resource from wrong V8Js object passed in %s on line %d
|
|
bool(false)
|
|
object(V8Object)#%d (1) {
|
|
["hello"]=>
|
|
string(5) "world"
|
|
}
|
|
===EOF===
|