0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-09-16 19:15:17 +00:00

Make sure all tests and samples use the new exception class name V8JsScriptException.

This commit is contained in:
Simon Best 2013-04-14 00:36:31 +01:00
parent 8d8c671aa0
commit 7e90439cdf
23 changed files with 39 additions and 39 deletions

View File

@ -43,7 +43,7 @@ API
public mixed V8Js::executeString( string script [, string identifier [, int flags = V8Js::FLAG_NONE]])
// Returns uncaught pending exception or null if there is no pending exception.
public V8JsException V8Js::getPendingException( void )
public V8JsScriptException V8Js::getPendingException( void )
/** Static methods **/
@ -56,7 +56,7 @@ API
public static array V8Js::getExtensions( void )
}
final class V8JsException extends Exception
final class V8JsScriptException extends Exception
{
/* Properties */
protected string JsFileName = NULL;

View File

@ -69,6 +69,6 @@ try {
$blaa->executeString('PHP.obj.foo(1,2,3);', "call_test1 #8.js");
echo "------------\n";
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}

View File

@ -6,6 +6,6 @@ $a->func = function ($a) { echo "Closure..\n"; };
try {
$a->executeString("print(PHP.func); PHP.func(1);", "closure_test.js");
$a->executeString("print(PHP.func); PHP.func(1);", "closure_test.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}

View File

@ -4,6 +4,6 @@ $a = new V8Js();
try {
var_dump($a->executeString("date = new Date('September 8, 1975 09:00:00'); print(date + '\\n'); date;", "test.js"));
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}

View File

@ -54,6 +54,6 @@ try {
$a->executeString("var patt1=/[^a-h]/g; var_dump(patt1);", "call_test5.js");
$a->executeString("var_dump(Math.PI, Infinity, null, undefined);", "call_test6.js");
// $a->executeString($JS);
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}

View File

@ -19,7 +19,7 @@
try {
$foo = new Foo();
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e);
}

View File

@ -27,7 +27,7 @@
try {
$foo = new Foo();
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo "PHP Exception: ", $e->getMessage(), "\n";
}

View File

@ -18,6 +18,6 @@ echo $a;
try {
$a->executeString("PHP.mytest(PHP.foo, PHP.my_private, PHP.my_protected);", "test7.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}

View File

@ -23,13 +23,13 @@ $a->executeString("PHP.myobj.mytest(3.14, 42, null);", "test3.js");
// Invalid parameters
try {
$a->executeString("PHP.myobj.mytest();", "test4.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}
try {
$a->executeString("PHP.myobj.mytest('arg1', 'arg2', 'arg3', 'extra_arg');", "test5.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}
@ -37,12 +37,12 @@ try {
try {
// date_default_timezone_set("UTC");
$a->executeString("date = new Date('September 8, 1975 09:00:00'); PHP.print(date); PHP.myobj.mytest(date, PHP.myobj, new Array(1,2,3));", "test6.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
try {
$a->executeString("PHP.myobj.mytest(PHP.myobj, new Array(1,2,3), new Array('foo', 'bar', PHP.myobj));", "test7.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}

View File

@ -139,7 +139,7 @@ $a->executeString("bigarray()", "test1.js");
try {
echo($a->executeString($jstparser, "test2.js")), "\n";
var_dump($a->executeString($jsontemplate, "test1.js"));
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage();
}
@ -168,6 +168,6 @@ var_dump($b->executeString("print('foobar\\n');"));
try {
$b->executeString("foobar; foo();", "extest.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e, $e->getJsFileName(), $e->getJsLineNumber(), $e->getJsSourceLine(), $e->getJsTrace());
}

View File

@ -14,7 +14,7 @@ $v8 = new V8Js();
try {
var_dump($v8->executeString($JS, 'basic.js'));
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
?>

View File

@ -10,7 +10,7 @@ $a->func = function ($arg) { echo "Hello {$arg}, I'm Closure!\n"; };
try {
$a->executeString('print(PHP.func + "\n"); PHP.func("foobar");', "closure_test.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}
?>

View File

@ -19,7 +19,7 @@ $a->func = function ($arg) use ($b) { return call_user_func($b, $arg); };
try {
$a->executeString('print(PHP.func + "\n"); print(PHP.func("world") + "\n");', "closure_test.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}
?>

View File

@ -14,7 +14,7 @@ $v8->__construct();
try {
$v8->executeString($JS, 'basic.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
?>

View File

@ -27,7 +27,7 @@ $a->ctx = '#1';
try {
echo '1. ';
$a->executeString($JS_set, 'set.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
@ -38,7 +38,7 @@ $b->ctx = '#2';
try {
echo '2. ';
$b->executeString($JS_change, 'change.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
@ -46,7 +46,7 @@ try {
try {
echo '3. ';
$a->executeString($JS_read, 'read.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
@ -54,7 +54,7 @@ try {
try {
echo '4. ';
$a->executeString($JS_change, 'change.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
@ -62,7 +62,7 @@ try {
try {
echo '5. ';
$a->executeString($JS_read, 'read.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
?>

View File

@ -14,7 +14,7 @@ $a->foo = 'from first.js';
try {
$a->executeString($JS, 'first.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
@ -25,7 +25,7 @@ $b->foo = 'from second.js';
try {
$b->executeString($JS, 'second.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}

View File

@ -1,5 +1,5 @@
--TEST--
Test V8::executeString() : V8JsException
Test V8::executeString() : V8JsScriptException
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
@ -13,13 +13,13 @@ $v8 = new V8Js();
try {
$v8->executeString($JS, 'exception.js');
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
?>
===EOF===
--EXPECTF--
object(V8JsException)#2 (11) {
object(V8JsScriptException)#2 (11) {
["message":protected]=>
string(75) "exception.js:1: ReferenceError: this_function_does_not_exist is not defined"
["string":"Exception":private]=>

View File

@ -27,7 +27,7 @@ class Foo {
try {
$foo = new Foo();
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e);
}
?>

View File

@ -27,13 +27,13 @@ class Foo {
try {
$foo = new Foo();
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo "PHP Exception: ", $e->getMessage(), "\n"; //var_dump($e);
}
?>
===EOF===
--EXPECTF--
object(V8JsException)#3 (11) {
object(V8JsScriptException)#3 (11) {
["message":protected]=>
string(49) "throw_0:1: ReferenceError: fooobar is not defined"
["string":"Exception":private]=>

View File

@ -26,7 +26,7 @@ class Foo {
try {
$foo = new Foo();
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo "PHP Exception: ", $e->getMessage(), "\n";
}
?>

View File

@ -15,7 +15,7 @@ try {
var_dump($v8->executeString($js, 'assoc_no_flags.js'));
echo "---\n";
var_dump($v8->executeString($js, 'assoc_force_to_array.js', V8Js::FLAG_FORCE_ARRAY));
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
?>

View File

@ -17,7 +17,7 @@ try {
$v8->executeString($js, 'no_flags.js');
echo "---\n";
$v8->executeString($js, 'force_to_array.js', V8Js::FLAG_FORCE_ARRAY);
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}
?>

View File

@ -36,13 +36,13 @@ $a->executeString("PHP.myobj.mytest(3.14, 42, null);", "test3.js");
// Invalid parameters
try {
$a->executeString("PHP.myobj.mytest();", "test4.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}
try {
$a->executeString("PHP.myobj.mytest('arg1', 'arg2', 'arg3', 'extra_arg');", "test5.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}
@ -50,14 +50,14 @@ try {
echo "\nTEST: Javascript Date -> PHP DateTime\n";
echo "======================================\n";
$a->executeString("date = new Date('September 8, 1975 09:00:00 GMT'); print(date.toUTCString() + '\\n'); PHP.myobj.mydatetest(date, 'foo');", "test6.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
echo $e->getMessage(), "\n";
}
// Array / Object
try {
$a->executeString("PHP.myobj.mytest(PHP.myobj, new Array(1,2,3), new Array('foo', 'bar', PHP.myobj));", "test7.js");
} catch (V8JsException $e) {
} catch (V8JsScriptException $e) {
var_dump($e);
}