gdscript_test_runner.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*************************************************************************/
  2. /* gdscript_test_runner.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "gdscript_test_runner.h"
  31. #include "../gdscript.h"
  32. #include "../gdscript_analyzer.h"
  33. #include "../gdscript_compiler.h"
  34. #include "../gdscript_parser.h"
  35. #include "core/config/project_settings.h"
  36. #include "core/core_globals.h"
  37. #include "core/core_string_names.h"
  38. #include "core/io/dir_access.h"
  39. #include "core/io/file_access_pack.h"
  40. #include "core/os/os.h"
  41. #include "core/string/string_builder.h"
  42. #include "scene/resources/packed_scene.h"
  43. #include "tests/test_macros.h"
  44. namespace GDScriptTests {
  45. void init_autoloads() {
  46. HashMap<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list();
  47. // First pass, add the constants so they exist before any script is loaded.
  48. for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : ProjectSettings::get_singleton()->get_autoload_list()) {
  49. const ProjectSettings::AutoloadInfo &info = E.value;
  50. if (info.is_singleton) {
  51. for (int i = 0; i < ScriptServer::get_language_count(); i++) {
  52. ScriptServer::get_language(i)->add_global_constant(info.name, Variant());
  53. }
  54. }
  55. }
  56. // Second pass, load into global constants.
  57. for (const KeyValue<StringName, ProjectSettings::AutoloadInfo> &E : ProjectSettings::get_singleton()->get_autoload_list()) {
  58. const ProjectSettings::AutoloadInfo &info = E.value;
  59. if (!info.is_singleton) {
  60. // Skip non-singletons since we don't have a scene tree here anyway.
  61. continue;
  62. }
  63. Ref<Resource> res = ResourceLoader::load(info.path);
  64. ERR_CONTINUE_MSG(res.is_null(), "Can't autoload: " + info.path);
  65. Node *n = nullptr;
  66. Ref<PackedScene> scn = res;
  67. Ref<Script> script = res;
  68. if (scn.is_valid()) {
  69. n = scn->instantiate();
  70. } else if (script.is_valid()) {
  71. StringName ibt = script->get_instance_base_type();
  72. bool valid_type = ClassDB::is_parent_class(ibt, "Node");
  73. ERR_CONTINUE_MSG(!valid_type, "Script does not inherit from Node: " + info.path);
  74. Object *obj = ClassDB::instantiate(ibt);
  75. ERR_CONTINUE_MSG(!obj, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt) + ".");
  76. n = Object::cast_to<Node>(obj);
  77. n->set_script(script);
  78. }
  79. ERR_CONTINUE_MSG(!n, "Path in autoload not a node or script: " + info.path);
  80. n->set_name(info.name);
  81. for (int i = 0; i < ScriptServer::get_language_count(); i++) {
  82. ScriptServer::get_language(i)->add_global_constant(info.name, n);
  83. }
  84. }
  85. }
  86. void init_language(const String &p_base_path) {
  87. // Setup project settings since it's needed by the languages to get the global scripts.
  88. // This also sets up the base resource path.
  89. Error err = ProjectSettings::get_singleton()->setup(p_base_path, String(), true);
  90. if (err) {
  91. print_line("Could not load project settings.");
  92. // Keep going since some scripts still work without this.
  93. }
  94. // Initialize the language for the test routine.
  95. GDScriptLanguage::get_singleton()->init();
  96. init_autoloads();
  97. }
  98. void finish_language() {
  99. GDScriptLanguage::get_singleton()->finish();
  100. ScriptServer::global_classes_clear();
  101. }
  102. StringName GDScriptTestRunner::test_function_name;
  103. GDScriptTestRunner::GDScriptTestRunner(const String &p_source_dir, bool p_init_language) {
  104. test_function_name = StaticCString::create("test");
  105. do_init_languages = p_init_language;
  106. source_dir = p_source_dir;
  107. if (!source_dir.ends_with("/")) {
  108. source_dir += "/";
  109. }
  110. if (do_init_languages) {
  111. init_language(p_source_dir);
  112. }
  113. #ifdef DEBUG_ENABLED
  114. // Enable all warnings for GDScript, so we can test them.
  115. ProjectSettings::get_singleton()->set_setting("debug/gdscript/warnings/enable", true);
  116. for (int i = 0; i < (int)GDScriptWarning::WARNING_MAX; i++) {
  117. String warning = GDScriptWarning::get_name_from_code((GDScriptWarning::Code)i).to_lower();
  118. ProjectSettings::get_singleton()->set_setting("debug/gdscript/warnings/" + warning, true);
  119. }
  120. #endif
  121. // Enable printing to show results
  122. CoreGlobals::print_line_enabled = true;
  123. CoreGlobals::print_error_enabled = true;
  124. }
  125. GDScriptTestRunner::~GDScriptTestRunner() {
  126. test_function_name = StringName();
  127. if (do_init_languages) {
  128. finish_language();
  129. }
  130. }
  131. #ifndef DEBUG_ENABLED
  132. static String strip_warnings(const String &p_expected) {
  133. // On release builds we don't have warnings. Here we remove them from the output before comparison
  134. // so it doesn't fail just because of difference in warnings.
  135. String expected_no_warnings;
  136. for (String line : p_expected.split("\n")) {
  137. if (line.begins_with(">> ")) {
  138. continue;
  139. }
  140. expected_no_warnings += line + "\n";
  141. }
  142. return expected_no_warnings.strip_edges() + "\n";
  143. }
  144. #endif
  145. int GDScriptTestRunner::run_tests() {
  146. if (!make_tests()) {
  147. FAIL("An error occurred while making the tests.");
  148. return -1;
  149. }
  150. if (!generate_class_index()) {
  151. FAIL("An error occurred while generating class index.");
  152. return -1;
  153. }
  154. int failed = 0;
  155. for (int i = 0; i < tests.size(); i++) {
  156. GDScriptTest test = tests[i];
  157. GDScriptTest::TestResult result = test.run_test();
  158. String expected = FileAccess::get_file_as_string(test.get_output_file());
  159. #ifndef DEBUG_ENABLED
  160. expected = strip_warnings(expected);
  161. #endif
  162. INFO(test.get_source_file());
  163. if (!result.passed) {
  164. INFO(expected);
  165. failed++;
  166. }
  167. CHECK_MESSAGE(result.passed, (result.passed ? String() : result.output));
  168. }
  169. return failed;
  170. }
  171. bool GDScriptTestRunner::generate_outputs() {
  172. is_generating = true;
  173. if (!make_tests()) {
  174. print_line("Failed to generate a test output.");
  175. return false;
  176. }
  177. if (!generate_class_index()) {
  178. return false;
  179. }
  180. for (int i = 0; i < tests.size(); i++) {
  181. OS::get_singleton()->print(".");
  182. GDScriptTest test = tests[i];
  183. bool result = test.generate_output();
  184. if (!result) {
  185. print_line("\nCould not generate output for " + test.get_source_file());
  186. return false;
  187. }
  188. }
  189. print_line("\nGenerated output files for " + itos(tests.size()) + " tests successfully.");
  190. return true;
  191. }
  192. bool GDScriptTestRunner::make_tests_for_dir(const String &p_dir) {
  193. Error err = OK;
  194. Ref<DirAccess> dir(DirAccess::open(p_dir, &err));
  195. if (err != OK) {
  196. return false;
  197. }
  198. String current_dir = dir->get_current_dir();
  199. dir->list_dir_begin();
  200. String next = dir->get_next();
  201. while (!next.is_empty()) {
  202. if (dir->current_is_dir()) {
  203. if (next == "." || next == "..") {
  204. next = dir->get_next();
  205. continue;
  206. }
  207. if (!make_tests_for_dir(current_dir.path_join(next))) {
  208. return false;
  209. }
  210. } else {
  211. if (next.get_extension().to_lower() == "gd") {
  212. #ifndef DEBUG_ENABLED
  213. // On release builds, skip tests marked as debug only.
  214. Error open_err = OK;
  215. Ref<FileAccess> script_file(FileAccess::open(current_dir.path_join(next), FileAccess::READ, &open_err));
  216. if (open_err != OK) {
  217. ERR_PRINT(vformat(R"(Couldn't open test file "%s".)", next));
  218. next = dir->get_next();
  219. continue;
  220. } else {
  221. if (script_file->get_line() == "#debug-only") {
  222. next = dir->get_next();
  223. continue;
  224. }
  225. }
  226. #endif
  227. String out_file = next.get_basename() + ".out";
  228. if (!is_generating && !dir->file_exists(out_file)) {
  229. ERR_FAIL_V_MSG(false, "Could not find output file for " + next);
  230. }
  231. GDScriptTest test(current_dir.path_join(next), current_dir.path_join(out_file), source_dir);
  232. tests.push_back(test);
  233. }
  234. }
  235. next = dir->get_next();
  236. }
  237. dir->list_dir_end();
  238. return true;
  239. }
  240. bool GDScriptTestRunner::make_tests() {
  241. Error err = OK;
  242. Ref<DirAccess> dir(DirAccess::open(source_dir, &err));
  243. ERR_FAIL_COND_V_MSG(err != OK, false, "Could not open specified test directory.");
  244. source_dir = dir->get_current_dir() + "/"; // Make it absolute path.
  245. return make_tests_for_dir(dir->get_current_dir());
  246. }
  247. bool GDScriptTestRunner::generate_class_index() {
  248. StringName gdscript_name = GDScriptLanguage::get_singleton()->get_name();
  249. for (int i = 0; i < tests.size(); i++) {
  250. GDScriptTest test = tests[i];
  251. String base_type;
  252. String class_name = GDScriptLanguage::get_singleton()->get_global_class_name(test.get_source_file(), &base_type);
  253. if (class_name.is_empty()) {
  254. continue;
  255. }
  256. ERR_FAIL_COND_V_MSG(ScriptServer::is_global_class(class_name), false,
  257. "Class name '" + class_name + "' from " + test.get_source_file() + " is already used in " + ScriptServer::get_global_class_path(class_name));
  258. ScriptServer::add_global_class(class_name, base_type, gdscript_name, test.get_source_file());
  259. }
  260. return true;
  261. }
  262. GDScriptTest::GDScriptTest(const String &p_source_path, const String &p_output_path, const String &p_base_dir) {
  263. source_file = p_source_path;
  264. output_file = p_output_path;
  265. base_dir = p_base_dir;
  266. _print_handler.printfunc = print_handler;
  267. _error_handler.errfunc = error_handler;
  268. }
  269. void GDScriptTestRunner::handle_cmdline() {
  270. List<String> cmdline_args = OS::get_singleton()->get_cmdline_args();
  271. // TODO: this could likely be ported to use test commands:
  272. // https://github.com/godotengine/godot/pull/41355
  273. // Currently requires to startup the whole engine, which is slow.
  274. String test_cmd = "--gdscript-test";
  275. String gen_cmd = "--gdscript-generate-tests";
  276. for (List<String>::Element *E = cmdline_args.front(); E; E = E->next()) {
  277. String &cmd = E->get();
  278. if (cmd == test_cmd || cmd == gen_cmd) {
  279. if (E->next() == nullptr) {
  280. ERR_PRINT("Needed a path for the test files.");
  281. exit(-1);
  282. }
  283. const String &path = E->next()->get();
  284. GDScriptTestRunner runner(path, false);
  285. int failed = 0;
  286. if (cmd == test_cmd) {
  287. failed = runner.run_tests();
  288. } else {
  289. bool completed = runner.generate_outputs();
  290. failed = completed ? 0 : -1;
  291. }
  292. exit(failed);
  293. }
  294. }
  295. }
  296. void GDScriptTest::enable_stdout() {
  297. // TODO: this could likely be handled by doctest or `tests/test_macros.h`.
  298. OS::get_singleton()->set_stdout_enabled(true);
  299. OS::get_singleton()->set_stderr_enabled(true);
  300. }
  301. void GDScriptTest::disable_stdout() {
  302. // TODO: this could likely be handled by doctest or `tests/test_macros.h`.
  303. OS::get_singleton()->set_stdout_enabled(false);
  304. OS::get_singleton()->set_stderr_enabled(false);
  305. }
  306. void GDScriptTest::print_handler(void *p_this, const String &p_message, bool p_error, bool p_rich) {
  307. TestResult *result = (TestResult *)p_this;
  308. result->output += p_message + "\n";
  309. }
  310. void GDScriptTest::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) {
  311. ErrorHandlerData *data = (ErrorHandlerData *)p_this;
  312. GDScriptTest *self = data->self;
  313. TestResult *result = data->result;
  314. result->status = GDTEST_RUNTIME_ERROR;
  315. StringBuilder builder;
  316. builder.append(">> ");
  317. switch (p_type) {
  318. case ERR_HANDLER_ERROR:
  319. builder.append("ERROR");
  320. break;
  321. case ERR_HANDLER_WARNING:
  322. builder.append("WARNING");
  323. break;
  324. case ERR_HANDLER_SCRIPT:
  325. builder.append("SCRIPT ERROR");
  326. break;
  327. case ERR_HANDLER_SHADER:
  328. builder.append("SHADER ERROR");
  329. break;
  330. default:
  331. builder.append("Unknown error type");
  332. break;
  333. }
  334. builder.append("\n>> on function: ");
  335. builder.append(String::utf8(p_function));
  336. builder.append("()\n>> ");
  337. builder.append(String::utf8(p_file).trim_prefix(self->base_dir));
  338. builder.append("\n>> ");
  339. builder.append(itos(p_line));
  340. builder.append("\n>> ");
  341. builder.append(String::utf8(p_error));
  342. if (strlen(p_explanation) > 0) {
  343. builder.append("\n>> ");
  344. builder.append(String::utf8(p_explanation));
  345. }
  346. builder.append("\n");
  347. result->output = builder.as_string();
  348. }
  349. bool GDScriptTest::check_output(const String &p_output) const {
  350. Error err = OK;
  351. String expected = FileAccess::get_file_as_string(output_file, &err);
  352. ERR_FAIL_COND_V_MSG(err != OK, false, "Error when opening the output file.");
  353. String got = p_output.strip_edges(); // TODO: may be hacky.
  354. got += "\n"; // Make sure to insert newline for CI static checks.
  355. #ifndef DEBUG_ENABLED
  356. expected = strip_warnings(expected);
  357. #endif
  358. return got == expected;
  359. }
  360. String GDScriptTest::get_text_for_status(GDScriptTest::TestStatus p_status) const {
  361. switch (p_status) {
  362. case GDTEST_OK:
  363. return "GDTEST_OK";
  364. case GDTEST_LOAD_ERROR:
  365. return "GDTEST_LOAD_ERROR";
  366. case GDTEST_PARSER_ERROR:
  367. return "GDTEST_PARSER_ERROR";
  368. case GDTEST_ANALYZER_ERROR:
  369. return "GDTEST_ANALYZER_ERROR";
  370. case GDTEST_COMPILER_ERROR:
  371. return "GDTEST_COMPILER_ERROR";
  372. case GDTEST_RUNTIME_ERROR:
  373. return "GDTEST_RUNTIME_ERROR";
  374. }
  375. return "";
  376. }
  377. GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) {
  378. disable_stdout();
  379. TestResult result;
  380. result.status = GDTEST_OK;
  381. result.output = String();
  382. result.passed = false;
  383. Error err = OK;
  384. // Create script.
  385. Ref<GDScript> script;
  386. script.instantiate();
  387. script->set_path(source_file);
  388. script->set_script_path(source_file);
  389. err = script->load_source_code(source_file);
  390. if (err != OK) {
  391. enable_stdout();
  392. result.status = GDTEST_LOAD_ERROR;
  393. result.passed = false;
  394. ERR_FAIL_V_MSG(result, "\nCould not load source code for: '" + source_file + "'");
  395. }
  396. // Test parsing.
  397. GDScriptParser parser;
  398. err = parser.parse(script->get_source_code(), source_file, false);
  399. if (err != OK) {
  400. enable_stdout();
  401. result.status = GDTEST_PARSER_ERROR;
  402. result.output = get_text_for_status(result.status) + "\n";
  403. const List<GDScriptParser::ParserError> &errors = parser.get_errors();
  404. for (const GDScriptParser::ParserError &E : errors) {
  405. result.output += E.message + "\n"; // TODO: line, column?
  406. break; // Only the first error since the following might be cascading.
  407. }
  408. if (!p_is_generating) {
  409. result.passed = check_output(result.output);
  410. }
  411. return result;
  412. }
  413. // Test type-checking.
  414. GDScriptAnalyzer analyzer(&parser);
  415. err = analyzer.analyze();
  416. if (err != OK) {
  417. enable_stdout();
  418. result.status = GDTEST_ANALYZER_ERROR;
  419. result.output = get_text_for_status(result.status) + "\n";
  420. const List<GDScriptParser::ParserError> &errors = parser.get_errors();
  421. for (const GDScriptParser::ParserError &E : errors) {
  422. result.output += E.message + "\n"; // TODO: line, column?
  423. break; // Only the first error since the following might be cascading.
  424. }
  425. if (!p_is_generating) {
  426. result.passed = check_output(result.output);
  427. }
  428. return result;
  429. }
  430. #ifdef DEBUG_ENABLED
  431. StringBuilder warning_string;
  432. for (const GDScriptWarning &E : parser.get_warnings()) {
  433. const GDScriptWarning warning = E;
  434. warning_string.append(">> WARNING");
  435. warning_string.append("\n>> Line: ");
  436. warning_string.append(itos(warning.start_line));
  437. warning_string.append("\n>> ");
  438. warning_string.append(warning.get_name());
  439. warning_string.append("\n>> ");
  440. warning_string.append(warning.get_message());
  441. warning_string.append("\n");
  442. }
  443. result.output += warning_string.as_string();
  444. #endif
  445. // Test compiling.
  446. GDScriptCompiler compiler;
  447. err = compiler.compile(&parser, script.ptr(), false);
  448. if (err != OK) {
  449. enable_stdout();
  450. result.status = GDTEST_COMPILER_ERROR;
  451. result.output = get_text_for_status(result.status) + "\n";
  452. result.output = compiler.get_error();
  453. if (!p_is_generating) {
  454. result.passed = check_output(result.output);
  455. }
  456. return result;
  457. }
  458. // Script files matching this pattern are allowed to not contain a test() function.
  459. if (source_file.match("*.notest.gd")) {
  460. enable_stdout();
  461. result.passed = check_output(result.output);
  462. return result;
  463. }
  464. // Test running.
  465. const HashMap<StringName, GDScriptFunction *>::ConstIterator test_function_element = script->get_member_functions().find(GDScriptTestRunner::test_function_name);
  466. if (!test_function_element) {
  467. enable_stdout();
  468. result.status = GDTEST_LOAD_ERROR;
  469. result.output = "";
  470. result.passed = false;
  471. ERR_FAIL_V_MSG(result, "\nCould not find test function on: '" + source_file + "'");
  472. }
  473. script->reload();
  474. // Create object instance for test.
  475. Object *obj = ClassDB::instantiate(script->get_native()->get_name());
  476. Ref<RefCounted> obj_ref;
  477. if (obj->is_ref_counted()) {
  478. obj_ref = Ref<RefCounted>(Object::cast_to<RefCounted>(obj));
  479. }
  480. obj->set_script(script);
  481. GDScriptInstance *instance = static_cast<GDScriptInstance *>(obj->get_script_instance());
  482. // Setup output handlers.
  483. ErrorHandlerData error_data(&result, this);
  484. _print_handler.userdata = &result;
  485. _error_handler.userdata = &error_data;
  486. add_print_handler(&_print_handler);
  487. add_error_handler(&_error_handler);
  488. // Call test function.
  489. Callable::CallError call_err;
  490. instance->callp(GDScriptTestRunner::test_function_name, nullptr, 0, call_err);
  491. // Tear down output handlers.
  492. remove_print_handler(&_print_handler);
  493. remove_error_handler(&_error_handler);
  494. // Check results.
  495. if (call_err.error != Callable::CallError::CALL_OK) {
  496. enable_stdout();
  497. result.status = GDTEST_LOAD_ERROR;
  498. result.passed = false;
  499. ERR_FAIL_V_MSG(result, "\nCould not call test function on: '" + source_file + "'");
  500. }
  501. result.output = get_text_for_status(result.status) + "\n" + result.output;
  502. if (!p_is_generating) {
  503. result.passed = check_output(result.output);
  504. }
  505. if (obj_ref.is_null()) {
  506. memdelete(obj);
  507. }
  508. enable_stdout();
  509. return result;
  510. }
  511. GDScriptTest::TestResult GDScriptTest::run_test() {
  512. return execute_test_code(false);
  513. }
  514. bool GDScriptTest::generate_output() {
  515. TestResult result = execute_test_code(true);
  516. if (result.status == GDTEST_LOAD_ERROR) {
  517. return false;
  518. }
  519. Error err = OK;
  520. Ref<FileAccess> out_file = FileAccess::open(output_file, FileAccess::WRITE, &err);
  521. if (err != OK) {
  522. return false;
  523. }
  524. String output = result.output.strip_edges(); // TODO: may be hacky.
  525. output += "\n"; // Make sure to insert newline for CI static checks.
  526. out_file->store_string(output);
  527. return true;
  528. }
  529. } // namespace GDScriptTests