Compare commits

...

3 commits

Author SHA1 Message Date
509667045d
Add fix for output overflows during testing 2024-05-09 15:21:12 +02:00
98d1e9d239
Add config updates in test_stringify_variables 2024-05-09 15:21:03 +02:00
17cecf5ef3
Fix multiple issues regarding validation cleanup
Good that I'm writing unit tests for this shit.
2024-05-09 15:20:22 +02:00
3 changed files with 26 additions and 18 deletions

View file

@ -23,8 +23,19 @@ var singles: Array[CoreValidationSingle]
# +++ module +++
func _cleanup() -> void:
# Schemas
var schemas_remove_enty: Array[CoreValidationSchema] = []
for schema in schemas:
schemas_remove_enty.append(schema)
if !is_instance_valid(schema): continue
if !is_instance_valid(schema.parent):
logger.diag("Removing schema '" + schema.name + "'")
schema.queue_free()
for schema in schemas_remove_enty:
schemas.remove_at(schemas.find(schema))
# Singles
var singles_remove_enty: Array[CoreLoggerInstance] = []
var singles_remove_enty: Array[CoreValidationSingle] = []
for single in singles:
singles_remove_enty.append(single)
if !is_instance_valid(single): continue
@ -33,17 +44,6 @@ func _cleanup() -> void:
single.queue_free()
for single in singles_remove_enty:
singles.remove_at(singles.find(single))
# Schemas
var schemas_remove_enty: Array[CoreLoggerInstance] = []
for schema in schemas:
singles_remove_enty.append(schema)
if !is_instance_valid(schema): continue
if !is_instance_valid(schema.parent):
logger.diag("Removing schema '" + schema.name + "'")
schema.queue_free()
for schema in schemas_remove_enty:
schemas.remove_at(schemas.find(schema))
func _schedule() -> void:
# Singles
@ -61,10 +61,12 @@ func _schedule() -> void:
# +++ data validation +++
## Returns a new [CoreValidationSingle]
func get_single(data, parent: Node) -> CoreValidationSingle:
singles.append(parent)
return CoreValidationSingle.new(core, data, parent)
var single: CoreValidationSingle = CoreValidationSingle.new(core, data, parent)
singles.append(single)
return single
## Returns a new [CoreValidationSchema]
func get_schema(schema: Dictionary, parent: Node) -> CoreValidationSchema:
schemas.append(parent)
return CoreValidationSchema.new(core, schema, parent)
func get_schema(schema_dict: Dictionary, parent: Node) -> CoreValidationSchema:
var schema: CoreValidationSchema = CoreValidationSchema.new(core, schema_dict, parent)
schemas.append(schema)
return schema

View file

@ -160,7 +160,12 @@ func test_get_center() -> void:
# stringify_variables
func test_stringify_variables() -> void:
# Init CORE
await load_framework()
var core_config: CoreConfiguration = CoreConfiguration.new()
core_config.misc_stringify_show_type = true
core_config.misc_stringify_color_range8 = true
core_config.misc_stringify_array = true
core_config.misc_stringify_dictionary = true
await load_framework(core_config)
# Variables
var test_in_string: String = "null=%null%\nbool=%bool%\nint=%int%\nfloat=%float%\nstring=%string%\nstringname=%stringname%\ncolor=%color%\narray=%array%\ndict=%dictionary%\nnodepath=%nodepath%\nvec2=%vector2%\nvec2i=%vector2i%\nrect2=%rect2%\nrect2i=%rect2i%\ntrans2d=%transform2d%\nvec3=%vector3%\nvec3i=%vector3i%\nplane=%plane%\nquarternion=%quaternion%\naabb=%aabb%\ntrans3d=%transform3d%\nbasis=%basis%\nprojection=%projection%\nvec4=%vector4%\nvec4i=%vector4i%"

View file

@ -25,6 +25,7 @@ var callback: String = ""
# Unload framework after each test
func after_each() -> void:
callback = ""
await wait_process_time() # Prevent output overflows
await unload_framework()
# Framework management