mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-10-14 07:17:44 +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:
@@ -33,7 +33,7 @@ class TestScriptConversions : public CxxTest::TestSuite
|
||||
template <typename T>
|
||||
void convert_to(const T& value, const std::string& expected)
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
TS_ASSERT(script.LoadGlobalScripts());
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
@@ -52,7 +52,7 @@ class TestScriptConversions : public CxxTest::TestSuite
|
||||
template <typename T>
|
||||
void roundtrip(const T& value, const char* expected)
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
TS_ASSERT(script.LoadGlobalScripts());
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
@@ -74,7 +74,7 @@ class TestScriptConversions : public CxxTest::TestSuite
|
||||
template <typename T>
|
||||
void call_prototype_function(const T& u, const T& v, const std::string& func, const std::string& expected)
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
TS_ASSERT(script.LoadGlobalScripts());
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
|
||||
void test_integers()
|
||||
{
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
// using new uninitialized variables each time to be sure the test doesn't succeeed if ToJSVal doesn't touch the value at all.
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
roundtrip<float>(-std::numeric_limits<float>::infinity(), "-Infinity");
|
||||
convert_to<float>(std::numeric_limits<float>::quiet_NaN(), "NaN"); // can't use roundtrip since nan != nan
|
||||
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
float f = 0;
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
void test_utf8utf16_conversion()
|
||||
{
|
||||
// Fancier conversion: we store UTF8 and get UTF16 and vice-versa
|
||||
ScriptInterface script("Test", "Test", g_ScriptRuntime);
|
||||
ScriptInterface script("Test", "Test", g_ScriptContext);
|
||||
TS_ASSERT(script.LoadGlobalScripts());
|
||||
ScriptInterface::Request rq(script);
|
||||
|
||||
|
||||
@@ -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