add gut testing framework
This commit is contained in:
parent
b4ca5f576c
commit
197704b82b
29 changed files with 5720 additions and 0 deletions
38
game/test/tests.tscn
Normal file
38
game/test/tests.tscn
Normal file
|
@ -0,0 +1,38 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/gut/gut.gd" type="Script" id=1]
|
||||
|
||||
[node name="Gut" type="Control"]
|
||||
self_modulate = Color( 1, 1, 1, 0 )
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_min_size = Vector2( 740, 250 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
_select_script = ""
|
||||
_tests_like = ""
|
||||
_inner_class_name = ""
|
||||
_run_on_load = false
|
||||
_should_maximize = false
|
||||
_should_print_to_console = true
|
||||
_log_level = 1
|
||||
_yield_between_tests = false
|
||||
_disable_strict_datatype_checks = false
|
||||
_test_prefix = "test_"
|
||||
_file_prefix = "test_"
|
||||
_file_extension = ".gd"
|
||||
_inner_class_prefix = "Test"
|
||||
_temp_directory = "user://gut_temp_directory"
|
||||
_export_path = ""
|
||||
_include_subdirectories = false
|
||||
_directory1 = "res://test/unit"
|
||||
_directory2 = ""
|
||||
_directory3 = ""
|
||||
_directory4 = ""
|
||||
_directory5 = ""
|
||||
_directory6 = ""
|
||||
_double_strategy = 1
|
||||
_pre_run_script = ""
|
||||
_post_run_script = ""
|
27
game/test/unit/test_example.gd
Normal file
27
game/test/unit/test_example.gd
Normal file
|
@ -0,0 +1,27 @@
|
|||
extends "res://addons/gut/test.gd"
|
||||
func before_each():
|
||||
gut.p("ran setup", 2)
|
||||
|
||||
func after_each():
|
||||
gut.p("ran teardown", 2)
|
||||
|
||||
func before_all():
|
||||
gut.p("ran run setup", 2)
|
||||
|
||||
func after_all():
|
||||
gut.p("ran run teardown", 2)
|
||||
|
||||
func test_assert_eq_number_not_equal():
|
||||
assert_eq(1, 2, "Should fail. 1 != 2")
|
||||
|
||||
func test_assert_eq_number_equal():
|
||||
assert_eq('asdf', 'asdf', "Should pass")
|
||||
|
||||
func test_assert_true_with_true():
|
||||
assert_true(true, "Should pass, true is true")
|
||||
|
||||
func test_assert_true_with_false():
|
||||
assert_true(false, "Should fail")
|
||||
|
||||
func test_something_else():
|
||||
assert_true(false, "didn't work")
|
Loading…
Add table
Add a link
Reference in a new issue