diff --git a/binaries/data/mods/_test.sim/simulation/components/test-destroyentity.js b/binaries/data/mods/_test.sim/simulation/components/test-destroyentity.js index 2920a6423d..5641f661d1 100644 --- a/binaries/data/mods/_test.sim/simulation/components/test-destroyentity.js +++ b/binaries/data/mods/_test.sim/simulation/components/test-destroyentity.js @@ -3,6 +3,7 @@ function TestScript1_DestroyEntity() {} TestScript1_DestroyEntity.prototype.GetX = function() { Engine.DestroyEntity(10); + return 0; }; Engine.RegisterComponentType(IID_Test1, "TestScript1_DestroyEntity", TestScript1_DestroyEntity); diff --git a/source/scriptinterface/tests/test_ScriptConversions.h b/source/scriptinterface/tests/test_ScriptConversions.h index 6f181830ec..d47af09390 100644 --- a/source/scriptinterface/tests/test_ScriptConversions.h +++ b/source/scriptinterface/tests/test_ScriptConversions.h @@ -21,6 +21,7 @@ #include "maths/Fixed.h" #include "maths/MathUtil.h" +#include "ps/CLogger.h" #include "js/jsapi.h" @@ -82,16 +83,20 @@ public: roundtrip(-123, "-123"); roundtrip(1073741822, "1073741822"); // JSVAL_INT_MAX-1 roundtrip(1073741823, "1073741823"); // JSVAL_INT_MAX - roundtrip(1073741824, "1073741824"); // JSVAL_INT_MAX+1 roundtrip(-1073741823, "-1073741823"); // JSVAL_INT_MIN+1 roundtrip(-1073741824, "-1073741824"); // JSVAL_INT_MIN - roundtrip(-1073741825, "-1073741825"); // JSVAL_INT_MIN-1 roundtrip(0, "0"); roundtrip(123, "123"); roundtrip(1073741822, "1073741822"); // JSVAL_INT_MAX-1 roundtrip(1073741823, "1073741823"); // JSVAL_INT_MAX - roundtrip(1073741824, "1073741824"); // JSVAL_INT_MAX+1 + + { + TestLogger log; // swallow warnings about values not being stored as INT jsvals + roundtrip(1073741824, "1073741824"); // JSVAL_INT_MAX+1 + roundtrip(-1073741825, "-1073741825"); // JSVAL_INT_MIN-1 + roundtrip(1073741824, "1073741824"); // JSVAL_INT_MAX+1 + } std::string s1 = "test"; s1[1] = '\0'; diff --git a/source/simulation2/tests/test_ComponentManager.h b/source/simulation2/tests/test_ComponentManager.h index bc4ae8721b..7f6ea2baf5 100644 --- a/source/simulation2/tests/test_ComponentManager.h +++ b/source/simulation2/tests/test_ComponentManager.h @@ -334,8 +334,10 @@ public: man.AddComponent(ent1, man.LookupCID("TestScript1A"), noParam); man.AddComponent(ent2, man.LookupCID("TestScript1A"), noParam); + TestLogger log; TS_ASSERT_EQUALS(static_cast (man.QueryInterface(ent1, IID_Test1))->GetX(), (int)ent1); TS_ASSERT_EQUALS(static_cast (man.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2); + TS_ASSERT_WSTR_CONTAINS(log.GetOutput(), L"this.entity is read-only"); } void test_script_QueryInterface() @@ -641,7 +643,10 @@ public: man.AddComponent(ent3, man.LookupCID("TestScript1_nontree"), testParam); TS_ASSERT_EQUALS(static_cast (man.QueryInterface(ent1, IID_Test1))->GetX(), 1234); - TS_ASSERT_EQUALS(static_cast (man.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2); + { + TestLogger log; // swallow warnings about this.entity being read-only + TS_ASSERT_EQUALS(static_cast (man.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2); + } TS_ASSERT_EQUALS(static_cast (man.QueryInterface(ent3, IID_Test1))->GetX(), 8); std::stringstream debugStream; @@ -672,7 +677,10 @@ public: TS_ASSERT(man2.QueryInterface(ent1, IID_Test1) == NULL); TS_ASSERT(man2.DeserializeState(stateStream)); TS_ASSERT_EQUALS(static_cast (man2.QueryInterface(ent1, IID_Test1))->GetX(), 1234); - TS_ASSERT_EQUALS(static_cast (man2.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2); + { + TestLogger log; // swallow warnings about this.entity being read-only + TS_ASSERT_EQUALS(static_cast (man2.QueryInterface(ent2, IID_Test1))->GetX(), (int)ent2); + } TS_ASSERT_EQUALS(static_cast (man2.QueryInterface(ent3, IID_Test1))->GetX(), 12); }