Adding log.gd

This commit is contained in:
Dan Baker 2024-05-02 09:36:31 +01:00
parent eb32d6614e
commit 4522259397
547 changed files with 46844 additions and 0 deletions

View file

@ -0,0 +1,18 @@
class_name GdUnitTestSuiteBuilder
extends RefCounted
static func create(source :Script, line_number :int) -> GdUnitResult:
var test_suite_path := GdUnitTestSuiteScanner.resolve_test_suite_path(source.resource_path, GdUnitSettings.test_root_folder())
# we need to save and close the testsuite and source if is current opened before modify
ScriptEditorControls.save_an_open_script(source.resource_path)
ScriptEditorControls.save_an_open_script(test_suite_path, true)
if GdObjects.is_cs_script(source):
return GdUnit4CSharpApiLoader.create_test_suite(source.resource_path, line_number+1, test_suite_path)
var parser := GdScriptParser.new()
var lines := source.source_code.split("\n")
var current_line := lines[line_number]
var func_name := parser.parse_func_name(current_line)
if func_name.is_empty():
return GdUnitResult.error("No function found at line: %d." % line_number)
return GdUnitTestSuiteScanner.create_test_case(test_suite_path, func_name, source.resource_path)