0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-11-08 13:48:40 +00:00
phpv8/tests/commonjs_normalise_003.phpt
Stefan Siegl 441f7b7fab v8js_commonjs_split_terms: use pointer comparison instead of strlen
The strlen usage on term obviously was wrong here, since the term
string is not null-terminated at that place.
2015-08-01 19:54:23 +02:00

28 lines
626 B
PHP

--TEST--
Test V8Js::setModuleLoader : Path normalisation #003
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$JS = <<< EOT
var foo = require("foo/test");
var foo = require("foo/bar/baz/test");
var foo = require("foo//bar//baz//blub");
EOT;
$v8 = new V8Js();
$v8->setModuleLoader(function($module) {
print("setModuleLoader called for ".$module."\n");
return 'exports.bar = 23;';
});
$v8->executeString($JS, 'module.js');
?>
===EOF===
--EXPECT--
setModuleLoader called for foo/test
setModuleLoader called for foo/bar/baz/test
setModuleLoader called for foo/bar/baz/blub
===EOF===