CORE/Test.gd

54 lines
1.9 KiB
GDScript

# CORE FRAMEWORK TEST FILE
# Copyright (c) 2024 The StarOpenSource Project & Contributors
# Licensed under the GNU Affero General Public License v3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
## CORE testing playground
##
## This script is used to test CORE's behaviour during development.
## It's state should be reverted to how it was before committing (if modified).
## For more permanent tests write a unit test instead.
extends Node
var core: Core
var config: CoreConfiguration = CoreConfiguration.new()
@onready var logger: CoreLoggerInstance = core.logger.get_instance("Test.gd", self)
func _init() -> void:
# Update config keys
config.headless = false
config.development = true
# Initialize CORE with custom config
core = Core.new(config)
func _ready() -> void:
# Inject CORE
await get_tree().process_frame
get_tree().root.add_child(core)
await core.complete_init()
# Print information about CORE
logger.info(await core.get_formatted_string("""Version information:
Release (semantic) = %version_semantic%
Release = %version%
Typerelease = %version_typerelease%
Type = %version_type%
Type (technical) = %version_type_technical%
Development mode = %devmode%
Headless mode = %headless%
Custom module support = %custommodules%"""))
# Print hi
logger.info("Hi there!")