diff options
Diffstat (limited to 'modules/gdscript/tests')
4 files changed, 28 insertions, 2 deletions
diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp index de5cd10e7c..ff4832bde0 100644 --- a/modules/gdscript/tests/gdscript_test_runner.cpp +++ b/modules/gdscript/tests/gdscript_test_runner.cpp @@ -363,7 +363,7 @@ void GDScriptTest::disable_stdout() { OS::get_singleton()->set_stderr_enabled(false); } -void GDScriptTest::print_handler(void *p_this, const String &p_message, bool p_error) { +void GDScriptTest::print_handler(void *p_this, const String &p_message, bool p_error, bool p_rich) { TestResult *result = (TestResult *)p_this; result->output += p_message + "\n"; } diff --git a/modules/gdscript/tests/gdscript_test_runner.h b/modules/gdscript/tests/gdscript_test_runner.h index d6c6419e21..ee21afd9c9 100644 --- a/modules/gdscript/tests/gdscript_test_runner.h +++ b/modules/gdscript/tests/gdscript_test_runner.h @@ -86,7 +86,7 @@ private: TestResult execute_test_code(bool p_is_generating); public: - static void print_handler(void *p_this, const String &p_message, bool p_error); + static void print_handler(void *p_this, const String &p_message, bool p_error, bool p_rich); static void error_handler(void *p_this, const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_explanation, bool p_editor_notify, ErrorHandlerType p_type); TestResult run_test(); bool generate_output(); diff --git a/modules/gdscript/tests/scripts/runtime/features/chain_assignment_works.gd b/modules/gdscript/tests/scripts/runtime/features/chain_assignment_works.gd new file mode 100644 index 0000000000..d2f3a3e18f --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/chain_assignment_works.gd @@ -0,0 +1,19 @@ +func test(): + var dictionary1: Variant = {1:Vector2()} + dictionary1[1].x = 2 + var dictionary2: Dictionary = {3:Vector2()} + dictionary2[3].x = 4 + var array1: Variant = [[Vector2()]] + array1[0][0].x = 5 + var array2: Array = [[Vector2()]] + array2[0][0].x = 6 + var array3: Array[Array] = [[Vector2()]] + array3[0][0].x = 7 + var transform = Transform3D() + transform.basis.x = Vector3(8.0, 9.0, 7.0) + print(dictionary1) + print(dictionary2) + print(array1) + print(array2) + print(array3) + print(transform) diff --git a/modules/gdscript/tests/scripts/runtime/features/chain_assignment_works.out b/modules/gdscript/tests/scripts/runtime/features/chain_assignment_works.out new file mode 100644 index 0000000000..5e7ccf534a --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/chain_assignment_works.out @@ -0,0 +1,7 @@ +GDTEST_OK +{1:(2, 0)} +{3:(4, 0)} +[[(5, 0)]] +[[(6, 0)]] +[[(7, 0)]] +[X: (8, 9, 7), Y: (0, 1, 0), Z: (0, 0, 1), O: (0, 0, 0)] |