Add sample unit test script and test directories
This commit is contained in:
parent
ee282cf148
commit
496484dc6d
|
@ -0,0 +1,44 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/gut/gut.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/gut/icon.png" type="Texture" id=2]
|
||||
|
||||
[node name="Gut" type="WindowDialog" index="0"]
|
||||
|
||||
anchor_left = 0.0
|
||||
anchor_top = 0.0
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 48.0
|
||||
margin_bottom = 40.0
|
||||
rect_pivot_offset = Vector2( 0, 0 )
|
||||
rect_clip_content = false
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 0
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
popup_exclusive = false
|
||||
window_title = ""
|
||||
resizable = false
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_editor_icon": ExtResource( 2 )
|
||||
}
|
||||
_run_on_load = false
|
||||
_select_script = null
|
||||
_tests_like = null
|
||||
_should_print_to_console = true
|
||||
_log_level = 1
|
||||
_yield_between_tests = true
|
||||
_disable_strict_datatype_checks = false
|
||||
_test_prefix = "test_"
|
||||
_file_prefix = "test_"
|
||||
_file_extension = ".gd"
|
||||
_directory1 = "res://tests/unit"
|
||||
_directory2 = "res://tests/integration"
|
||||
_directory3 = ""
|
||||
_directory4 = ""
|
||||
_directory5 = ""
|
||||
_directory6 = ""
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
extends "res://addons/gut/test.gd"
|
||||
# @see https://github.com/bitwes/Gut#creating_tests
|
||||
var node = null;
|
||||
|
||||
func setup():
|
||||
var n = preload('res://tests/test-2d.tscn')
|
||||
node = n.instance()
|
||||
|
||||
func test_node_has_exit_button():
|
||||
var b = node.get_node('CenterContainer/exit')
|
||||
assert_true(b != null, 'CenterContainer/exit is not null')
|
||||
if (b):
|
||||
assert_true(b.get_class() == 'Button', 'CenterContainer/exit is a Button')
|
||||
var connected = gut.p(b.get_signal_connection_list('pressed'))
|
||||
assert_true(connected != [], 'CenterContainer/exit has connected signals')
|
||||
|
Loading…
Reference in New Issue