diff --git a/addons/gdUnit4/test/GdUnitTestResourceLoader.gd b/addons/gdUnit4/test/GdUnitTestResourceLoader.gd index 38202170..99af432c 100644 --- a/addons/gdUnit4/test/GdUnitTestResourceLoader.gd +++ b/addons/gdUnit4/test/GdUnitTestResourceLoader.gd @@ -62,6 +62,11 @@ static func load_cs_script(resource_path :String, debug_write := false) -> Scrip static func load_gd_script(resource_path :String, debug_write := false) -> GDScript: + # grap current level + var unsafe_method_access: Variant = ProjectSettings.get_setting("debug/gdscript/warnings/unsafe_method_access") + # disable and load the script + ProjectSettings.set_setting("debug/gdscript/warnings/unsafe_method_access", 0) + var script := GDScript.new() script.source_code = GdUnitFileAccess.resource_as_string(resource_path) var script_resource_path := resource_path.replace(resource_path.get_extension(), "gd") @@ -78,4 +83,6 @@ static func load_gd_script(resource_path :String, debug_write := false) -> GDScr var error := script.reload() if error != OK: push_error("Errors on loading script %s. Error: %s" % [resource_path, error_string(error)]) + ProjectSettings.set_setting("debug/gdscript/warnings/unsafe_method_access", unsafe_method_access) return script + #@warning_ignore("unsafe_cast") diff --git a/addons/gdUnit4/test/core/resources/testsuites/TestSuiteFailAddChildStageBefore.resource b/addons/gdUnit4/test/core/resources/testsuites/TestSuiteFailAddChildStageBefore.resource index bf2e91f6..c49b5682 100644 --- a/addons/gdUnit4/test/core/resources/testsuites/TestSuiteFailAddChildStageBefore.resource +++ b/addons/gdUnit4/test/core/resources/testsuites/TestSuiteFailAddChildStageBefore.resource @@ -2,6 +2,7 @@ extends GdUnitTestSuite func before() -> void: + @warning_ignore("unsafe_cast") add_child(auto_free(Node.new()) as Node) func test_case1() -> void: diff --git a/addons/gdUnit4/test/core/resources/testsuites/TestSuiteFuzzedMetricsTest.resource b/addons/gdUnit4/test/core/resources/testsuites/TestSuiteFuzzedMetricsTest.resource index 30f0a305..51842ced 100644 --- a/addons/gdUnit4/test/core/resources/testsuites/TestSuiteFuzzedMetricsTest.resource +++ b/addons/gdUnit4/test/core/resources/testsuites/TestSuiteFuzzedMetricsTest.resource @@ -48,7 +48,7 @@ func after() -> void: .is_equal(1) for test_case :String in _metrics.keys(): - var statistics := _metrics[test_case] as TestCaseStatistics + var statistics: TestCaseStatistics = _metrics[test_case] assert_int(statistics._testcase_before_called)\ .override_failure_message("Expect before_test called %s times but is %s for test case %s" % [statistics._expected_calls, statistics._testcase_before_called, test_case])\ .is_equal(statistics._expected_calls) diff --git a/addons/gdUnit4/test/core/resources/testsuites/TestSuiteParameterizedMetricsTest.resource b/addons/gdUnit4/test/core/resources/testsuites/TestSuiteParameterizedMetricsTest.resource index 2f49a82f..4d8a8c29 100644 --- a/addons/gdUnit4/test/core/resources/testsuites/TestSuiteParameterizedMetricsTest.resource +++ b/addons/gdUnit4/test/core/resources/testsuites/TestSuiteParameterizedMetricsTest.resource @@ -46,7 +46,7 @@ func after() -> void: .is_equal(1) for test_case :String in _metrics.keys(): - var statistics := _metrics[test_case] as TestCaseStatistics + var statistics: TestCaseStatistics = _metrics[test_case] assert_int(statistics._testcase_before_called)\ .override_failure_message("Expect before_test called %s times but is %s for test case %s" % [statistics._expected_calls, statistics._testcase_before_called, test_case])\ .is_equal(statistics._expected_calls) diff --git a/addons/gdUnit4/test/core/resources/testsuites/TestSuiteParameterizedTests.resource b/addons/gdUnit4/test/core/resources/testsuites/TestSuiteParameterizedTests.resource index 4e1a7231..b89719e8 100644 --- a/addons/gdUnit4/test/core/resources/testsuites/TestSuiteParameterizedTests.resource +++ b/addons/gdUnit4/test/core/resources/testsuites/TestSuiteParameterizedTests.resource @@ -44,7 +44,7 @@ func after() -> void: .is_equal(1) for test_case :String in _metrics.keys(): - var statistics := _metrics[test_case] as TestCaseStatistics + var statistics: TestCaseStatistics = _metrics[test_case] assert_int(statistics._testcase_before_called)\ .override_failure_message("Expect before_test called %s times but is %s for test case %s" % [statistics._expected_testcase_before, statistics._testcase_before_called, test_case])\ .is_equal(statistics._expected_testcase_before)