Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade gdUnit4 4.2.0->4.2.5 #4

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .gdlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
class-definitions-order:
- tools
- classnames
- extends
- docstrings
- signals
- enums
- consts
- exports
- pubvars
- prvvars
- onreadypubvars
- onreadyprvvars
- staticvars
- others
class-load-variable-name: (([A-Z][a-z0-9]*)+|_?[a-z][a-z0-9]*(_[a-z0-9]+)*)
class-name: ([A-Z][a-z0-9]*)+
class-variable-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
comparison-with-itself: null
constant-name: _?[A-Z][A-Z0-9]*(_[A-Z0-9]+)*
disable: []
duplicated-load: null
enum-element-name: "[A-Z][A-Z0-9]*(_[A-Z0-9]+)*"
enum-name: ([A-Z][a-z0-9]*)+
excluded_directories: !!set
.git: null
expression-not-assigned: null
function-argument-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
function-arguments-number: 10
function-name: (_on_([A-Z][a-z0-9]*)+(_[a-z0-9]+)*|_?[a-z][a-z0-9]*(_[a-z0-9]+)*)
function-preload-variable-name: ([A-Z][a-z0-9]*)+
function-variable-name: "[a-z][a-z0-9]*(_[a-z0-9]+)*"
load-constant-name: (([A-Z][a-z0-9]*)+|_?[A-Z][A-Z0-9]*(_[A-Z0-9]+)*)
loop-variable-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
max-file-lines: 1000
max-line-length: 140
max-public-methods: 40
max-returns: 6
mixed-tabs-and-spaces: null
no-elif-return: null
no-else-return: null
private-method-call: null
signal-name: "[a-z][a-z0-9]*(_[a-z0-9]+)*"
sub-class-name: _?([A-Z][a-z0-9]*)+
tab-characters: 1
trailing-whitespace: null
unnecessary-pass: null
unused-argument: null
38 changes: 38 additions & 0 deletions .runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<MaxCpuCount>1</MaxCpuCount>
<ResultsDirectory>./TestResults</ResultsDirectory>
<TargetFramework>net8.0</TargetFramework>
<TestSessionTimeout>180000</TestSessionTimeout>
<TreatNoTestsAsError>true</TreatNoTestsAsError>
</RunConfiguration>

<LoggerRunSettings>
<Loggers>
<Logger friendlyName="console" enabled="True">
<Configuration>
<Verbosity>detailed</Verbosity>
</Configuration>
</Logger>
<Logger friendlyName="html" enabled="True">
<Configuration>
<LogFileName>test-result.html</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="trx" enabled="True">
<Configuration>
<LogFileName>test-result.trx</LogFileName>
</Configuration>
</Logger>
</Loggers>
</LoggerRunSettings>

<GdUnit4>
<!-- Additonal Godot runtime parameters-->
<Parameters></Parameters>
<!-- Controlls the Display name attribute of the TestCase. Allowed values are SimpleName and FullyQualifiedName.
This likely determines how the test names are displayed in the test results.-->
<DisplayName>FullyQualifiedName</DisplayName>
</GdUnit4>
</RunSettings>
39 changes: 39 additions & 0 deletions .runsettings-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<MaxCpuCount>1</MaxCpuCount>
<ResultsDirectory>./TestResults</ResultsDirectory>
<TargetFramework>net8.0</TargetFramework>
<TestSessionTimeout>180000</TestSessionTimeout>
<TreatNoTestsAsError>true</TreatNoTestsAsError>
</RunConfiguration>

<LoggerRunSettings>
<Loggers>
<Logger friendlyName="console" enabled="True">
<Configuration>
<Verbosity>detailed</Verbosity>
</Configuration>
</Logger>
<Logger friendlyName="html" enabled="True">
<Configuration>
<LogFileName>test-result.html</LogFileName>
</Configuration>
</Logger>
<Logger friendlyName="trx" enabled="True">
<Configuration>
<LogFileName>test-result.trx</LogFileName>
</Configuration>
</Logger>
</Loggers>
</LoggerRunSettings>

<GdUnit4>
<!-- Additonal Godot runtime parameters-->
<!-- These parameters are crucial for configuring the Godot runtime to work in headless environments, such as those used in automated testing or CI/CD pipelines.-->
<Parameters>--audio-driver Dummy --display-driver x11 --rendering-driver opengl3 --screen 0</Parameters>
<!-- Controlls the Display name attribute of the TestCase. Allowed values are SimpleName and FullyQualifiedName.
This likely determines how the test names are displayed in the test results.-->
<DisplayName>FullyQualifiedName</DisplayName>
</GdUnit4>
</RunSettings>
1 change: 0 additions & 1 deletion addons/gdUnit4/GdUnitRunner.cfg

This file was deleted.

25 changes: 18 additions & 7 deletions addons/gdUnit4/bin/GdUnitBuildTool.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
extends SceneTree

enum {
INIT, PROCESSING, EXIT
INIT,
PROCESSING,
EXIT
}

const RETURN_SUCCESS = 0
Expand All @@ -11,9 +13,19 @@ const RETURN_WARNING = 101

var _console := CmdConsole.new()
var _cmd_options: = CmdOptions.new([
CmdOption.new("-scp, --src_class_path", "-scp <source_path>", "The full class path of the source file.", TYPE_STRING),
CmdOption.new("-scl, --src_class_line", "-scl <line_number>", "The selected line number to generate test case.", TYPE_INT)
])
CmdOption.new(
"-scp, --src_class_path",
"-scp <source_path>",
"The full class path of the source file.",
TYPE_STRING
),
CmdOption.new(
"-scl, --src_class_line",
"-scl <line_number>",
"The selected line number to generate test case.",
TYPE_INT
)
])

var _status := INIT
var _source_file :String = ""
Expand Down Expand Up @@ -49,13 +61,11 @@ func _idle(_delta):
var script := ResourceLoader.load(_source_file) as Script
if script == null:
exit(RETURN_ERROR, "Can't load source file %s!" % _source_file)

var result := GdUnitTestSuiteBuilder.create(script, _source_line)
if result.is_error():
print_json_error(result.error_message())
exit(RETURN_ERROR, result.error_message())
return

_console.prints_color("Added testcase: %s" % result.value(), Color.CORNFLOWER_BLUE)
print_json_result(result.value())
exit(RETURN_SUCCESS)
Expand Down Expand Up @@ -86,7 +96,8 @@ func print_json_error(error :String) -> void:
func show_options() -> void:
_console.prints_color(" Usage:", Color.DARK_SALMON)
_console.prints_color(" build -scp <source_path> -scl <line_number>", Color.DARK_SALMON)
_console.prints_color("-- Options ---------------------------------------------------------------------------------------", Color.DARK_SALMON).new_line()
_console.prints_color("-- Options ---------------------------------------------------------------------------------------",
Color.DARK_SALMON).new_line()
for option in _cmd_options.default_options():
descripe_option(option)

Expand Down
Loading