mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-27 13:07:38 +00:00
Rename ScriptRuntime to ScriptContext
SM52 essentially replaces JSRuntime with JSContext (though JSContext itself was replaced with JSCompartment). To prepare for this migration, rename all Runtime-related things to Context. Part of the SM52 migration, stage: SM45 compatible. Patch by: Itms Refs #4893 Differential Revision: https://code.wildfiregames.com/D3091 This was SVN commit r24181.
This commit is contained in:
@@ -28,7 +28,7 @@ class TestScriptInterface : public CxxTest::TestSuite
|
||||
public:
|
||||
void test_loadscript_basic()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
TestLogger logger;
|
||||
TS_ASSERT(script.LoadScript(L"test.js", "var x = 1+1;"));
|
||||
TS_ASSERT_STR_NOT_CONTAINS(logger.GetOutput(), "JavaScript error");
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
|
||||
void test_loadscript_error()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
TestLogger logger;
|
||||
TS_ASSERT(!script.LoadScript(L"test.js", "1+"));
|
||||
TS_ASSERT_STR_CONTAINS(logger.GetOutput(), "JavaScript error: test.js line 1\nSyntaxError: expected expression, got end of script");
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
void test_loadscript_strict_warning()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
TestLogger logger;
|
||||
// in strict mode, this inside a function doesn't point to the global object
|
||||
TS_ASSERT(script.LoadScript(L"test.js", "var isStrict = (function() { return !this; })();warn('isStrict is '+isStrict);"));
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
void test_loadscript_strict_error()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
TestLogger logger;
|
||||
TS_ASSERT(!script.LoadScript(L"test.js", "with(1){}"));
|
||||
TS_ASSERT_STR_CONTAINS(logger.GetOutput(), "JavaScript error: test.js line 1\nSyntaxError: strict mode code may not contain \'with\' statements");
|
||||
@@ -62,8 +62,8 @@ public:
|
||||
|
||||
void test_clone_basic()
|
||||
{
|
||||
ScriptInterface script1("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script2("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script1("Test", "Test", g_ScriptContext);
|
||||
ScriptInterface script2("Test", "Test", g_ScriptContext);
|
||||
|
||||
ScriptInterface::Request rq1(script1);
|
||||
JS::RootedValue obj1(rq1.cx);
|
||||
@@ -83,8 +83,8 @@ public:
|
||||
void test_clone_getters()
|
||||
{
|
||||
// The tests should be run with JS_SetGCZeal so this can try to find GC bugs
|
||||
ScriptInterface script1("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script2("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script1("Test", "Test", g_ScriptContext);
|
||||
ScriptInterface script2("Test", "Test", g_ScriptContext);
|
||||
|
||||
ScriptInterface::Request rq1(script1);
|
||||
|
||||
@@ -104,8 +104,8 @@ public:
|
||||
|
||||
void test_clone_cyclic()
|
||||
{
|
||||
ScriptInterface script1("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script2("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script1("Test", "Test", g_ScriptContext);
|
||||
ScriptInterface script2("Test", "Test", g_ScriptContext);
|
||||
|
||||
ScriptInterface::Request rq1(script1);
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
*/
|
||||
void test_rooted_templates()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
|
||||
void test_random()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
|
||||
double d1, d2;
|
||||
TS_ASSERT(script.Eval("Math.random()", d1));
|
||||
@@ -235,7 +235,7 @@ public:
|
||||
|
||||
void test_json()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
std::string input = "({'x':1,'z':[2,'3\\u263A\\ud800'],\"y\":true})";
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
// extends the functionality and is then assigned to the name of the function.
|
||||
void test_function_override()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
TS_ASSERT(script.Eval(
|
||||
|
||||
Reference in New Issue
Block a user