mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-14 03:48:41 +00:00
28 lines
532 B
Plaintext
28 lines
532 B
Plaintext
|
--TEST--
|
||
|
Test V8Js::setModuleLoader : Module source naming
|
||
|
--SKIPIF--
|
||
|
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||
|
--FILE--
|
||
|
<?php
|
||
|
|
||
|
$JS = <<< EOT
|
||
|
require('./foo//bar');
|
||
|
EOT;
|
||
|
|
||
|
$v8 = new V8Js();
|
||
|
$v8->setModuleLoader(function($module) {
|
||
|
// return code with syntax errors to provoke script exception
|
||
|
return "foo(blar);";
|
||
|
});
|
||
|
|
||
|
try {
|
||
|
$v8->executeString($JS, 'commonjs_source_naming.js');
|
||
|
} catch (V8JsScriptException $e) {
|
||
|
var_dump($e->getJsFileName());
|
||
|
}
|
||
|
?>
|
||
|
===EOF===
|
||
|
--EXPECT--
|
||
|
string(7) "foo/bar"
|
||
|
===EOF===
|