chore: add GUT test framework
This commit is contained in:
42
addons/gut/test/panel_demo_scripts/test_all_passing.gd
Normal file
42
addons/gut/test/panel_demo_scripts/test_all_passing.gd
Normal file
@@ -0,0 +1,42 @@
|
||||
extends 'res://addons/gut/test.gd'
|
||||
|
||||
|
||||
func test_passing_1():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_2():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_3():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_4():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_5():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_6():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_7():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_8():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_9():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_10():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_11():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_12():
|
||||
pass_test("this passes")
|
||||
|
||||
func test_passing_13():
|
||||
pass_test("this passes")
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://dtfa2fjkl5nnl
|
||||
37
addons/gut/test/panel_demo_scripts/test_inner_classes.gd
Normal file
37
addons/gut/test/panel_demo_scripts/test_inner_classes.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
extends GutTest
|
||||
|
||||
func test_this_is_only_a_test():
|
||||
fail_test('but it is failing')
|
||||
|
||||
func test_duplicate_name():
|
||||
pending('base level duplicate')
|
||||
|
||||
|
||||
class TestPassingDupeNames:
|
||||
extends GutTest
|
||||
|
||||
func test_duplicate_name():
|
||||
pass_test('this one passes')
|
||||
|
||||
func test_duplicate_name_two():
|
||||
pass_test('this also passes')
|
||||
|
||||
|
||||
class TestBrokenDupedNames:
|
||||
extends GutTest
|
||||
|
||||
func test_duplicate_name():
|
||||
fail_test('this one fails')
|
||||
|
||||
func test_duplicate_name_two():
|
||||
pending('this one is pending')
|
||||
|
||||
|
||||
class TestInner:
|
||||
extends GutTest
|
||||
|
||||
func test_something_cool():
|
||||
pass_test('cool is cool')
|
||||
|
||||
func test_something_not_cool():
|
||||
fail_test('failing is not cool')
|
||||
@@ -0,0 +1 @@
|
||||
uid://iqr6p6b7ch0g
|
||||
63
addons/gut/test/panel_demo_scripts/test_totals_testing.gd
Normal file
63
addons/gut/test/panel_demo_scripts/test_totals_testing.gd
Normal file
@@ -0,0 +1,63 @@
|
||||
extends GutTest
|
||||
|
||||
func test_passing_test():
|
||||
pass_test('did it!')
|
||||
|
||||
func test_failing_test():
|
||||
fail_test('did not do it!')
|
||||
|
||||
func test_generates_error():
|
||||
gut.logger.error('This is a manual error')
|
||||
pass_test('passing')
|
||||
|
||||
func test_generates_warning():
|
||||
gut.logger.warn("This is a manual warning")
|
||||
pass_test('passing')
|
||||
|
||||
func test_multiple_passing_asserts():
|
||||
assert_eq(1, 1)
|
||||
assert_eq(2, 2)
|
||||
assert_eq('a', 'a')
|
||||
|
||||
func test_multiple_failing():
|
||||
assert_ne(1, 1)
|
||||
assert_ne(2, 2)
|
||||
assert_ne('a', 'a')
|
||||
|
||||
func test_multiple_failing2():
|
||||
assert_ne(1, 1)
|
||||
assert_ne(2, 2)
|
||||
|
||||
func test_makes_orphan():
|
||||
var orphan = Node2D.new()
|
||||
assert_true(true)
|
||||
|
||||
func test_makes_an_info():
|
||||
gut.logger.info("here is some info")
|
||||
pass_test('info pass!')
|
||||
|
||||
func test_pending():
|
||||
pending("this is pending")
|
||||
|
||||
func test_no_assert():
|
||||
gut.p('this has no assert')
|
||||
|
||||
func test_this_makes_3_orphans():
|
||||
var n1 = Node2D.new()
|
||||
var n2 = Node2D.new()
|
||||
var n3 = Node2D.new()
|
||||
pass_test('passing')
|
||||
|
||||
func test_this_autofrees_2_of_3():
|
||||
var n1 = add_child_autofree(Node2D.new())
|
||||
var n2 = autofree(Node2D.new())
|
||||
var n3 = Node2D.new()
|
||||
pass_test('passing')
|
||||
|
||||
func test_fail_with_orphans():
|
||||
var n1 = Node2D.new()
|
||||
fail_test('failing with orphans')
|
||||
|
||||
func test_no_assert_and_orphans():
|
||||
var n1 = Node2D.new()
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://eaqhkvqhyc2l
|
||||
16
addons/gut/test/panel_demo_scripts/test_with_parameters.gd
Normal file
16
addons/gut/test/panel_demo_scripts/test_with_parameters.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends GutTest
|
||||
|
||||
func test_all_passing(p = use_parameters([1, 2, 3, 4, 5, 6, 7, 8])):
|
||||
assert_true(true, str('this always passes ', p))
|
||||
|
||||
func test_all_failing(p = use_parameters([1, 2, 3, 4, 5, 6, 7, 8])):
|
||||
assert_true(false, str('this always passes ', p))
|
||||
|
||||
func test_some_failing(p = use_parameters([1, 2, 3, 4, 5, 6, 7, 8])):
|
||||
assert_true(p%2 == 0, str('is even ', p))
|
||||
|
||||
func test_has_a_pending_in_middle(p = use_parameters([1, 2, 3, 4, 5, 6, 7, 8])):
|
||||
if(p == 5):
|
||||
pending("five is pending")
|
||||
else:
|
||||
assert_true(p != 3, str('this always passes ', p))
|
||||
@@ -0,0 +1 @@
|
||||
uid://brhjmebi6ujyq
|
||||
Reference in New Issue
Block a user