gdscript_test_runner.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  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.ends_with(".notest.gd")) {
  212. next = dir->get_next();
  213. continue;
  214. } else if (next.get_extension().to_lower() == "gd") {
  215. #ifndef DEBUG_ENABLED
  216. // On release builds, skip tests marked as debug only.
  217. Error open_err = OK;
  218. Ref<FileAccess> script_file(FileAccess::open(current_dir.path_join(next), FileAccess::READ, &open_err));
  219. if (open_err != OK) {
  220. ERR_PRINT(vformat(R"(Couldn't open test file "%s".)", next));
  221. next = dir->get_next();
  222. continue;
  223. } else {
  224. if (script_file->get_line() == "#debug-only") {
  225. next = dir->get_next();
  226. continue;
  227. }
  228. }
  229. #endif
  230. String out_file = next.get_basename() + ".out";
  231. if (!is_generating && !dir->file_exists(out_file)) {
  232. ERR_FAIL_V_MSG(false, "Could not find output file for " + next);
  233. }
  234. GDScriptTest test(current_dir.path_join(next), current_dir.path_join(out_file), source_dir);
  235. tests.push_back(test);
  236. }
  237. }
  238. next = dir->get_next();
  239. }
  240. dir->list_dir_end();
  241. return true;
  242. }
  243. bool GDScriptTestRunner::make_tests() {
  244. Error err = OK;
  245. Ref<DirAccess> dir(DirAccess::open(source_dir, &err));
  246. ERR_FAIL_COND_V_MSG(err != OK, false, "Could not open specified test directory.");
  247. source_dir = dir->get_current_dir() + "/"; // Make it absolute path.
  248. return make_tests_for_dir(dir->get_current_dir());
  249. }
  250. bool GDScriptTestRunner::generate_class_index() {
  251. StringName gdscript_name = GDScriptLanguage::get_singleton()->get_name();
  252. for (int i = 0; i < tests.size(); i++) {
  253. GDScriptTest test = tests[i];
  254. String base_type;
  255. String class_name = GDScriptLanguage::get_singleton()->get_global_class_name(test.get_source_file(), &base_type);
  256. if (class_name.is_empty()) {
  257. continue;
  258. }
  259. ERR_FAIL_COND_V_MSG(ScriptServer::is_global_class(class_name), false,
  260. "Class name '" + class_name + "' from " + test.get_source_file() + " is already used in " + ScriptServer::get_global_class_path(class_name));
  261. ScriptServer::add_global_class(class_name, base_type, gdscript_name, test.get_source_file());
  262. }
  263. return true;
  264. }
  265. GDScriptTest::GDScriptTest(const String &p_source_path, const String &p_output_path, const String &p_base_dir) {
  266. source_file = p_source_path;
  267. output_file = p_output_path;
  268. base_dir = p_base_dir;
  269. _print_handler.printfunc = print_handler;
  270. _error_handler.errfunc = error_handler;
  271. }
  272. void GDScriptTestRunner::handle_cmdline() {
  273. List<String> cmdline_args = OS::get_singleton()->get_cmdline_args();
  274. // TODO: this could likely be ported to use test commands:
  275. // https://github.com/godotengine/godot/pull/41355
  276. // Currently requires to startup the whole engine, which is slow.
  277. String test_cmd = "--gdscript-test";
  278. String gen_cmd = "--gdscript-generate-tests";
  279. for (List<String>::Element *E = cmdline_args.front(); E; E = E->next()) {
  280. String &cmd = E->get();
  281. if (cmd == test_cmd || cmd == gen_cmd) {
  282. if (E->next() == nullptr) {
  283. ERR_PRINT("Needed a path for the test files.");
  284. exit(-1);
  285. }
  286. const String &path = E->next()->get();
  287. GDScriptTestRunner runner(path, false);
  288. int failed = 0;
  289. if (cmd == test_cmd) {
  290. failed = runner.run_tests();
  291. } else {
  292. bool completed = runner.generate_outputs();
  293. failed = completed ? 0 : -1;
  294. }
  295. exit(failed);
  296. }
  297. }
  298. }
  299. void GDScriptTest::enable_stdout() {
  300. // TODO: this could likely be handled by doctest or `tests/test_macros.h`.
  301. OS::get_singleton()->set_stdout_enabled(true);
  302. OS::get_singleton()->set_stderr_enabled(true);
  303. }
  304. void GDScriptTest::disable_stdout() {
  305. // TODO: this could likely be handled by doctest or `tests/test_macros.h`.
  306. OS::get_singleton()->set_stdout_enabled(false);
  307. OS::get_singleton()->set_stderr_enabled(false);
  308. }
  309. void GDScriptTest::print_handler(void *p_this, const String &p_message, bool p_error, bool p_rich) {
  310. TestResult *result = (TestResult *)p_this;
  311. result->output += p_message + "\n";
  312. }
  313. 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) {
  314. ErrorHandlerData *data = (ErrorHandlerData *)p_this;
  315. GDScriptTest *self = data->self;
  316. TestResult *result = data->result;
  317. result->status = GDTEST_RUNTIME_ERROR;
  318. StringBuilder builder;
  319. builder.append(">> ");
  320. switch (p_type) {
  321. case ERR_HANDLER_ERROR:
  322. builder.append("ERROR");
  323. break;
  324. case ERR_HANDLER_WARNING:
  325. builder.append("WARNING");
  326. break;
  327. case ERR_HANDLER_SCRIPT:
  328. builder.append("SCRIPT ERROR");
  329. break;
  330. case ERR_HANDLER_SHADER:
  331. builder.append("SHADER ERROR");
  332. break;
  333. default:
  334. builder.append("Unknown error type");
  335. break;
  336. }
  337. builder.append("\n>> on function: ");
  338. builder.append(String::utf8(p_function));
  339. builder.append("()\n>> ");
  340. builder.append(String::utf8(p_file).trim_prefix(self->base_dir));
  341. builder.append("\n>> ");
  342. builder.append(itos(p_line));
  343. builder.append("\n>> ");
  344. builder.append(String::utf8(p_error));
  345. if (strlen(p_explanation) > 0) {
  346. builder.append("\n>> ");
  347. builder.append(String::utf8(p_explanation));
  348. }
  349. builder.append("\n");
  350. result->output = builder.as_string();
  351. }
  352. bool GDScriptTest::check_output(const String &p_output) const {
  353. Error err = OK;
  354. String expected = FileAccess::get_file_as_string(output_file, &err);
  355. ERR_FAIL_COND_V_MSG(err != OK, false, "Error when opening the output file.");
  356. String got = p_output.strip_edges(); // TODO: may be hacky.
  357. got += "\n"; // Make sure to insert newline for CI static checks.
  358. #ifndef DEBUG_ENABLED
  359. expected = strip_warnings(expected);
  360. #endif
  361. return got == expected;
  362. }
  363. String GDScriptTest::get_text_for_status(GDScriptTest::TestStatus p_status) const {
  364. switch (p_status) {
  365. case GDTEST_OK:
  366. return "GDTEST_OK";
  367. case GDTEST_LOAD_ERROR:
  368. return "GDTEST_LOAD_ERROR";
  369. case GDTEST_PARSER_ERROR:
  370. return "GDTEST_PARSER_ERROR";
  371. case GDTEST_ANALYZER_ERROR:
  372. return "GDTEST_ANALYZER_ERROR";
  373. case GDTEST_COMPILER_ERROR:
  374. return "GDTEST_COMPILER_ERROR";
  375. case GDTEST_RUNTIME_ERROR:
  376. return "GDTEST_RUNTIME_ERROR";
  377. }
  378. return "";
  379. }
  380. GDScriptTest::TestResult GDScriptTest::execute_test_code(bool p_is_generating) {
  381. disable_stdout();
  382. TestResult result;
  383. result.status = GDTEST_OK;
  384. result.output = String();
  385. result.passed = false;
  386. Error err = OK;
  387. // Create script.
  388. Ref<GDScript> script;
  389. script.instantiate();
  390. script->set_path(source_file);
  391. err = script->load_source_code(source_file);
  392. if (err != OK) {
  393. enable_stdout();
  394. result.status = GDTEST_LOAD_ERROR;
  395. result.passed = false;
  396. ERR_FAIL_V_MSG(result, "\nCould not load source code for: '" + source_file + "'");
  397. }
  398. // Test parsing.
  399. GDScriptParser parser;
  400. err = parser.parse(script->get_source_code(), source_file, false);
  401. if (err != OK) {
  402. enable_stdout();
  403. result.status = GDTEST_PARSER_ERROR;
  404. result.output = get_text_for_status(result.status) + "\n";
  405. const List<GDScriptParser::ParserError> &errors = parser.get_errors();
  406. if (!errors.is_empty()) {
  407. // Only the first error since the following might be cascading.
  408. result.output += errors[0].message + "\n"; // TODO: line, column?
  409. }
  410. if (!p_is_generating) {
  411. result.passed = check_output(result.output);
  412. }
  413. return result;
  414. }
  415. // Test type-checking.
  416. GDScriptAnalyzer analyzer(&parser);
  417. err = analyzer.analyze();
  418. if (err != OK) {
  419. enable_stdout();
  420. result.status = GDTEST_ANALYZER_ERROR;
  421. result.output = get_text_for_status(result.status) + "\n";
  422. const List<GDScriptParser::ParserError> &errors = parser.get_errors();
  423. if (!errors.is_empty()) {
  424. // Only the first error since the following might be cascading.
  425. result.output += errors[0].message + "\n"; // TODO: line, column?
  426. }
  427. if (!p_is_generating) {
  428. result.passed = check_output(result.output);
  429. }
  430. return result;
  431. }
  432. #ifdef DEBUG_ENABLED
  433. StringBuilder warning_string;
  434. for (const GDScriptWarning &E : parser.get_warnings()) {
  435. const GDScriptWarning warning = E;
  436. warning_string.append(">> WARNING");
  437. warning_string.append("\n>> Line: ");
  438. warning_string.append(itos(warning.start_line));
  439. warning_string.append("\n>> ");
  440. warning_string.append(warning.get_name());
  441. warning_string.append("\n>> ");
  442. warning_string.append(warning.get_message());
  443. warning_string.append("\n");
  444. }
  445. result.output += warning_string.as_string();
  446. #endif
  447. // Test compiling.
  448. GDScriptCompiler compiler;
  449. err = compiler.compile(&parser, script.ptr(), false);
  450. if (err != OK) {
  451. enable_stdout();
  452. result.status = GDTEST_COMPILER_ERROR;
  453. result.output = get_text_for_status(result.status) + "\n";
  454. result.output = compiler.get_error();
  455. if (!p_is_generating) {
  456. result.passed = check_output(result.output);
  457. }
  458. return result;
  459. }
  460. // Script files matching this pattern are allowed to not contain a test() function.
  461. if (source_file.match("*.notest.gd")) {
  462. enable_stdout();
  463. result.passed = check_output(result.output);
  464. return result;
  465. }
  466. // Test running.
  467. const HashMap<StringName, GDScriptFunction *>::ConstIterator test_function_element = script->get_member_functions().find(GDScriptTestRunner::test_function_name);
  468. if (!test_function_element) {
  469. enable_stdout();
  470. result.status = GDTEST_LOAD_ERROR;
  471. result.output = "";
  472. result.passed = false;
  473. ERR_FAIL_V_MSG(result, "\nCould not find test function on: '" + source_file + "'");
  474. }
  475. script->reload();
  476. // Create object instance for test.
  477. Object *obj = ClassDB::instantiate(script->get_native()->get_name());
  478. Ref<RefCounted> obj_ref;
  479. if (obj->is_ref_counted()) {
  480. obj_ref = Ref<RefCounted>(Object::cast_to<RefCounted>(obj));
  481. }
  482. obj->set_script(script);
  483. GDScriptInstance *instance = static_cast<GDScriptInstance *>(obj->get_script_instance());
  484. // Setup output handlers.
  485. ErrorHandlerData error_data(&result, this);
  486. _print_handler.userdata = &result;
  487. _error_handler.userdata = &error_data;
  488. add_print_handler(&_print_handler);
  489. add_error_handler(&_error_handler);
  490. // Call test function.
  491. Callable::CallError call_err;
  492. instance->callp(GDScriptTestRunner::test_function_name, nullptr, 0, call_err);
  493. // Tear down output handlers.
  494. remove_print_handler(&_print_handler);
  495. remove_error_handler(&_error_handler);
  496. // Check results.
  497. if (call_err.error != Callable::CallError::CALL_OK) {
  498. enable_stdout();
  499. result.status = GDTEST_LOAD_ERROR;
  500. result.passed = false;
  501. ERR_FAIL_V_MSG(result, "\nCould not call test function on: '" + source_file + "'");
  502. }
  503. result.output = get_text_for_status(result.status) + "\n" + result.output;
  504. if (!p_is_generating) {
  505. result.passed = check_output(result.output);
  506. }
  507. if (obj_ref.is_null()) {
  508. memdelete(obj);
  509. }
  510. enable_stdout();
  511. GDScriptCache::remove_script(script->get_path());
  512. return result;
  513. }
  514. GDScriptTest::TestResult GDScriptTest::run_test() {
  515. return execute_test_code(false);
  516. }
  517. bool GDScriptTest::generate_output() {
  518. TestResult result = execute_test_code(true);
  519. if (result.status == GDTEST_LOAD_ERROR) {
  520. return false;
  521. }
  522. Error err = OK;
  523. Ref<FileAccess> out_file = FileAccess::open(output_file, FileAccess::WRITE, &err);
  524. if (err != OK) {
  525. return false;
  526. }
  527. String output = result.output.strip_edges(); // TODO: may be hacky.
  528. output += "\n"; // Make sure to insert newline for CI static checks.
  529. out_file->store_string(output);
  530. return true;
  531. }
  532. } // namespace GDScriptTests