chore: add GUT test framework

This commit is contained in:
xiaji
2026-05-29 09:16:10 +08:00
parent 5741ba1dc0
commit 07fc763413
808 changed files with 76903 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
[gd_resource type="FontFile" load_steps=2 format=2]
[sub_resource type="FontFile" id=9]
font_path = "res://addons/gut/fonts/LobsterTwo-BoldItalic.ttf"
[resource]
size = 40
font_data = SubResource( 9 )

View File

@@ -0,0 +1,6 @@
[gd_resource type="Theme" load_steps=2 format=2]
[ext_resource path="res://BigFont.tres" type="FontFile" id=1]
[resource]
default_font = ExtResource( 1 )

View File

@@ -0,0 +1,4 @@
extends GutTest
func test_something():
assert_gt(randf(), .5)

View File

@@ -0,0 +1 @@
uid://coac1tk76usy5

View File

@@ -0,0 +1,4 @@
extends GutTest
func test_something():
assert_gt(randf(), .5)

View File

@@ -0,0 +1 @@
uid://c44nt8q7748v3

View File

@@ -0,0 +1,4 @@
extends GutTest
func test_something():
assert_gt(randf(), .5)

View File

@@ -0,0 +1 @@
uid://bnk14c2usoxpj

View File

@@ -0,0 +1,4 @@
extends GutTest
func test_something():
assert_gt(randf(), .5)

View File

@@ -0,0 +1 @@
uid://bumfinakdvxvo

View File

@@ -0,0 +1,4 @@
extends GutTest
func test_something():
assert_gt(randf(), .5)

View File

@@ -0,0 +1 @@
uid://c1s0c7oexnsva

View File

@@ -0,0 +1,4 @@
extends GutTest
func test_something():
assert_gt(randf(), .5)

View File

@@ -0,0 +1 @@
uid://db4ayct3ohy4k

View File

@@ -0,0 +1,4 @@
extends GutTest
func test_something():
assert_gt(randf(), .5)

View File

@@ -0,0 +1 @@
uid://dj40j85rvmb4u

View File

@@ -0,0 +1,35 @@
{
"background_color": "292929ff",
"compact_mode": false,
"config_file": "res://.gutconfig.json",
"dirs": [
"res://test/resources/GutControlDirs",
"res://test/unit"
],
"disable_colors": false,
"double_strategy": "include super",
"font_color": "137700ff",
"font_name": "CourierPrime",
"font_size": 16,
"gut_on_top": true,
"hide_orphans": true,
"ignore_pause": true,
"include_subdirs": true,
"inner_class": null,
"junit_xml_file": "",
"junit_xml_timestamp": false,
"log_level": 3,
"opacity": 100,
"paint_after": 0.1,
"post_run_script": "",
"pre_run_script": "",
"prefix": "test_",
"selected": "test_i482_double_resource.gd",
"should_exit": false,
"should_exit_on_success": true,
"should_maximize": false,
"show_help": false,
"suffix": ".gd",
"tests": [],
"unit_test_name": null
}

View File

@@ -0,0 +1,4 @@
extends GutTest
func test_something():
assert_gt(randf(), .5)

View File

@@ -0,0 +1 @@
uid://dqsr018hngojo

View File

@@ -0,0 +1,3 @@
extends Node2D
@export var test_export_value : int = 1

View File

@@ -0,0 +1 @@
uid://cs7ybvtjq62ug

View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://b52ifmw525t3e"]
[ext_resource type="Script" uid="uid://cs7ybvtjq62ug" path="res://test/resources/Issue436Scene.gd" id="1_agu0v"]
[node name="Issue436Scene" type="Node2D"]
position = Vector2(10, 10)
script = ExtResource("1_agu0v")
test_export_value = 2

View File

@@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3 uid="uid://dbn4dla781ktv"]
[ext_resource type="Texture2D" uid="uid://co56ddpq6e4by" path="res://icon.png" id="1"]
[node name="SceneNoScript" type="Node2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(40, 41)
texture = ExtResource("1")

View File

@@ -0,0 +1,15 @@
extends 'res://addons/gut/hook_script.gd'
var awaited = false
func run():
print('!! --- post-run script awaiting --- !!')
var awaiter = GutUtils.Awaiter.new()
gut.add_child(awaiter)
awaiter.wait_seconds(1)
await awaiter.timeout
awaited = true
awaiter.queue_free()
print('!! --- post-run script has successfully awaited --- !!')

View File

@@ -0,0 +1 @@
uid://dei86w7avtpyf

View File

@@ -0,0 +1,15 @@
extends 'res://addons/gut/hook_script.gd'
var awaited = false
func run():
print('!! --- pre-run script awaiting --- !!')
var awaiter = GutUtils.Awaiter.new()
gut.add_child(awaiter)
awaiter.wait_seconds(1)
await awaiter.timeout
awaited = true
awaiter.queue_free()
print('!! --- pre-run script has successfully awaited --- !!')

View File

@@ -0,0 +1 @@
uid://b4pks8mr7w3wq

View File

@@ -0,0 +1,4 @@
var param1 = -1
func _init(p1):
param1 = p1

View File

@@ -0,0 +1 @@
uid://dn2vn3hy3enwp

View File

@@ -0,0 +1,55 @@
const SOME_CONSTANT = 5
enum SOME_VALUES {
VALUE_1,
VALUE_2,
VALUE_3
}
func return_passed(p1='a', p2='b'):
return str(p1, p2)
func call_me(p1, p2 = 2):
return str('called with ', p1, ', ', p2)
func call_call_me(p1):
return call_me(p1)
func default_array(p1=[]):
pass
func default_int(p1=SOME_CONSTANT):
pass
func default_string(p1='s'):
pass
func defaulted_second_parameter(p1, p2='p2'):
return str(p1, p2)
func default_last_two_boolean(p1, p2=true, p3=false):
pass
func default_vector3(p1=Vector3(1, 1, 1)):
pass
func default_typed_vector3(p1:Vector3=Vector3(1, 1, 1)):
pass
func default_color(p1=Color(.5, .5, .5)):
pass
func default_typed_color(p1:Color=Color(.6, .6, .6)):
pass
func default_enum(p1=SOME_VALUES.VALUE_1):
pass
func default_typed_enum(p1:SOME_VALUES = SOME_VALUES.VALUE_1):
pass
func no_defaults(p1, p2, p3):
pass

View File

@@ -0,0 +1 @@
uid://c75l7b6aeewms

View File

@@ -0,0 +1,16 @@
extends Node2D
var _value = 0
func get_value():
return _value
func set_value(val):
_value = val
func has_one_param(one):
pass
func has_two_params_one_default(one, two=null):
pass

View File

@@ -0,0 +1 @@
uid://dwoi7xy4q317l

View File

@@ -0,0 +1 @@
extends Window

View File

@@ -0,0 +1 @@
uid://d1nly6hoiuje1

View File

@@ -0,0 +1,73 @@
extends Node
var _value = 0
var should_might_await_await = true
signal signal_signal
func _ready():
pass
func _init():
pass
func get_value():
return _value
func set_value(val):
_value = val
func has_one_param(one):
pass
func has_two_params_one_default(one, two=null):
pass
func get_position():
return get_position()
func has_string_and_array_defaults(string_param = "asdf", array_param = [1]):
pass
func this_just_does_an_await():
await get_tree().create_timer(1)
func this_is_a_coroutine():
return await get_tree().create_timer(1)
func calls_coroutine():
return await this_is_a_coroutine()
func does_something_then_calls_coroutine_then_does_something_else():
print('This is before the coroutine call')
await this_is_a_coroutine()
print('something else')
return 10
func might_await(should, some_default=3):
if(should):
print('awaiting')
await this_is_a_coroutine()
else:
print('not awaiting')
return
func await_seconds(s):
await get_tree().create_timer(s).timeout
func might_await_no_return(some_default=3):
if(should_might_await_await):
print('awaiting')
await this_is_a_coroutine()
else:
print('not awaiting')
func uses_await_response():
var foo = await this_is_a_coroutine()
func default_is_value(val = _value):
return val

View File

@@ -0,0 +1 @@
uid://c4467a6ionqm0

View File

@@ -0,0 +1,12 @@
extends Node2D
@onready var label = get_node('Label')
func return_hello():
return 'hello'
func set_label_text(text):
$Label.set_text(text)
func get_button():
return $MyPanel/MyButton

View File

@@ -0,0 +1 @@
uid://w3axo60f4xar

View File

@@ -0,0 +1,23 @@
[gd_scene load_steps=2 format=3 uid="uid://8cnd7xm6f4m1"]
[ext_resource type="Script" uid="uid://w3axo60f4xar" path="res://test/resources/doubler_test_objects/double_me_scene.gd" id="1"]
[node name="Node2D" type="Node2D"]
script = ExtResource("1")
[node name="Label" type="Label" parent="."]
offset_right = 40.0
offset_bottom = 14.0
text = "This is a label"
[node name="MyPanel" type="Panel" parent="."]
offset_left = 40.0
offset_top = 42.0
offset_right = 178.0
offset_bottom = 131.0
[node name="MyButton" type="Button" parent="MyPanel"]
offset_left = 25.0
offset_top = 27.0
offset_right = 116.0
offset_bottom = 66.0

View File

@@ -0,0 +1,5 @@
static func this_is_a_static_method():
return true
func this_is_not_static():
return true

View File

@@ -0,0 +1 @@
uid://bgghn3smccafm

View File

@@ -0,0 +1,44 @@
class_name GutDoubleTestInnerClasses
var _value = 1
func get_value():
return _value
func set_value(val):
_value = val
class InnerA:
func get_a():
return 'a'
# Needed another class with same method as an inner class to test
# stubbing.
class AnotherInnerA:
func get_a():
return 'aia'
class InnerB:
func get_b():
return 'b'
class InnerB1:
func get_b1():
return 'b1'
class InnerCA:
extends InnerA
func get_ca():
return 'ca'
class InnerWithSignals:
signal signal_signal
class InnerExtendsNode2D:
extends Node2D

View File

@@ -0,0 +1 @@
uid://drsgxy4cpqtvn

View File

@@ -0,0 +1,9 @@
extends GutTest
func test_manual_error():
gut.logger.error("This is a manual error")
pass_test('we did it')
func test_manual_warning():
gut.logger.warn("This is a manual warning")
pass_test('we did it')

View File

@@ -0,0 +1 @@
uid://b7cwum48use88

View File

@@ -0,0 +1,25 @@
extends 'res://addons/gut/test.gd'
func test_pass_1():
assert_eq('one', 'one')
func test_pass_2():
assert_eq('two', 'two')
func test_fail_1():
assert_eq(1, 'two')
func test_fail_2():
assert_eq('two', 2)
func test_pending_no_text():
pending()
func test_pending_with_text():
pending('this has text')
func test_parameterized_passing(p=use_parameters([1, 2, 3, 4])):
assert_gt(p, 0)
func test_parameterized_failing(p = use_parameters([[1, 2], [3, 4]])):
assert_eq(p[0], p[1])

View File

@@ -0,0 +1 @@
uid://b6pnje22lv3hj

View File

@@ -0,0 +1,11 @@
extends 'res://addons/gut/test.gd'
func test_pass():
assert_eq('one', 'one')
func test_fail():
assert_eq(1, 'two')
func test_pending():
pending('this has text')

View File

@@ -0,0 +1 @@
uid://cjsptipvnesa1

View File

@@ -0,0 +1,25 @@
extends GutTest
func test_pending_with_null_message():
pending("The < and > in this message mess up the XML")
func test_failure_message_includes_str_of_null_in_message_1():
assert_not_null(null)
func test_failure_message_includes_str_of_null_in_message_2():
assert_eq('null', str(null))
func test_failure_message_includes_str_of_null_in_message_3():
assert_eq('a', 'b', "The < and > in this message mess up the XML")
class TestSkipWithNullMessage:
extends GutTest
func should_skip():
return null
func test_something_that_is_skipped():
assert_true(false, 'hello world')

View File

@@ -0,0 +1 @@
uid://k2sec8vc8qfb

View File

@@ -0,0 +1,23 @@
extends 'res://addons/gut/test.gd'
func more_accurate_wait_time(time_to_wait_msec : int)->void:
gut.p(str('-- Awaiting ', time_to_wait_msec / 1000.0, ' second(s) -- '))
var start := Time.get_ticks_msec()
while (Time.get_ticks_msec() - start < time_to_wait_msec):
await get_tree().process_frame
func test_pass_time_taken_about_half_s():
await more_accurate_wait_time(500)
assert_eq('one', 'one')
func test_fail_time_taken_about_half_s():
await more_accurate_wait_time(500)
assert_eq(1, 'two')
func test_pending_time_taken_about_half_s():
await more_accurate_wait_time(500)
pending('this has text')
func test_pass_time_taken_about_2s():
await more_accurate_wait_time(2000)
assert_eq('one', 'one')

View File

@@ -0,0 +1 @@
uid://c3xtlyqvys7ls

View File

@@ -0,0 +1,30 @@
extends 'res://addons/gut/test.gd'
class TestClassOne:
extends 'res://addons/gut/test.gd'
func test_pass_1():
assert_eq('one', 'one')
func test_fail_1():
assert_eq(1, 'two')
func test_pending_with_text():
pending('this has text')
class TestClassTwo:
extends 'res://addons/gut/test.gd'
func test_pass_1():
assert_eq('one', 'one')
func test_fail_1():
assert_eq(1, 'two')
func test_pending_with_text():
pending('this has text')

View File

@@ -0,0 +1 @@
uid://dikra3pwwycgc

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
extends GutTest
class TestPassingBeforeAllAssertNoOtherTests:
extends 'res://addons/gut/test.gd'
func before_all():
assert_true(true, 'before_all: this should pass')
class TestPassingAfterAllAssertNoOtherTests:
extends 'res://addons/gut/test.gd'
func after_all():
assert_true(true, 'after_all: this should pass')
class TestFailingBeforeAllAssertNoOtherTests:
extends 'res://addons/gut/test.gd'
func before_all():
assert_true(false, 'before_all: this should fail')
class TestFailingAfterAllAssertNoOtherTests:
extends 'res://addons/gut/test.gd'
func after_all():
assert_true(false, 'after_all: this should fail')
class TestHasBeforeAllAfterAllAndSomeTests:
extends 'res://addons/gut/test.gd'
func before_all():
assert_true(true, 'before_all: should pass')
func before_each():
assert_true(true, 'before_each: should pass')
func after_each():
assert_false(true, 'after_each: should fail')
func after_all():
assert_false(true, 'after_all: should fail')
func test_this_passes():
assert_eq(1, 1, 'should pass')
func test_this_fails():
fail_test('this fails')
class TestAnotherOneWithSomeTests:
extends TestHasBeforeAllAfterAllAndSomeTests

View File

@@ -0,0 +1 @@
uid://c1rof1biup1dn

View File

@@ -0,0 +1,5 @@
# Used to replicate issue #570 which caused a Godot Engine error:
# ERROR: Parameter "p_script->implicit_initializer" is null.
class_name ImplicitInitializerIssue
var foo = 'bar'

View File

@@ -0,0 +1 @@
uid://w08e3vc4jhvt

View File

@@ -0,0 +1 @@
var it_needs_something_in_the_file = "to not error"

View File

@@ -0,0 +1 @@
uid://b1gcgjlj0rsu5

View File

@@ -0,0 +1,3 @@
[gd_scene format=3 uid="uid://dtt3yfg7bla2r"]
[node name="ConstObject" type="Node2D"]

View File

@@ -0,0 +1,7 @@
extends "res://addons/gut/test.gd"
func before_each():
gut.p("ran before_each", 2)
func test_assert_eq_number_not_equal():
gut.assert_eq(1, 2, "Should fail. 1 != 2")

View File

@@ -0,0 +1 @@
uid://b3n3euwd8obnu

View File

@@ -0,0 +1,4 @@
extends 'res://addons/gut/test.gd'
# per issue 290, if a const is defined and it starts with "Test" then GUT will
# treat it like an inner test class. This should not happen.
const TestConstThing = preload('res://test/resources/parsing_and_loading_samples/ConstObject.tscn')

View File

@@ -0,0 +1 @@
uid://cq1k8wxlrqnl2

View File

@@ -0,0 +1,8 @@
const b_ref := preload('res://test/resources/parsing_and_loading_samples/cyclic_ref_class_b.gd')
class CyclicRefAInnerClass:
var foo = 'bar'
class CyclicRfAInnerInnerClass:
var bar = 'foo'

View File

@@ -0,0 +1 @@
uid://be5q6d3e8y4d

View File

@@ -0,0 +1,5 @@
const a_ref := preload('res://test/resources/parsing_and_loading_samples/cyclic_ref_class_a.gd')
class CyclicRefBInnerClass:
var foo = 'bar'

View File

@@ -0,0 +1 @@
uid://dir5mfqrjbigl

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/bad_prefix.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/extends_another_thing.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/has_inner_class.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/inner_classes_check_before_after.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/parse_samples.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/test_has_inner_class.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/test_only_inner_classes.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/test_samples.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/test_samples2.gdc"

View File

@@ -0,0 +1,3 @@
[remap]
path="res://test/resources/parsing_and_loading_samples/exported/test_samples3.gdc"

View File

@@ -0,0 +1,5 @@
# used to test doubler with duplicate methods.
extends 'res://addons/gut/test.gd'
func _ready():
pass

View File

@@ -0,0 +1 @@
uid://7njq61fgknsq

View File

@@ -0,0 +1,33 @@
extends "res://addons/gut/test.gd"
func test_something():
pass
func test_nothing():
pass
class TestClass1:
extends "res://addons/gut/test.gd"
func test_context1_one():
pass
func test_context1_two():
pass
func print_something():
print('hello world')
class DifferentPrefixClass:
extends "res://addons/gut/test.gd"
func test_something():
pass
func not_a_test():
pass
class DoesNotExtend:
func test_something_not_extended():
pass
class TestDoesNotExtendTest:
func test_something():
pass
class TestExtendsTestClass1:
extends TestClass1

View File

@@ -0,0 +1 @@
uid://v7vs3xl0ns3r

View File

@@ -0,0 +1,39 @@
# ##############################################################################
# These classes are used to verify that the befores and afters are being called
# correctly with inner classes.
# ##############################################################################
extends "res://addons/gut/test.gd"
class BeforeAfterCounterTest:
extends "res://addons/gut/test.gd"
var before_all_calls = 0
var before_each_calls = 0
var after_all_calls = 0
var after_each_calls = 0
func before_all():
before_all_calls += 1
func before_each():
before_each_calls += 1
func after_all():
after_all_calls += 1
func after_each():
after_each_calls += 1
class TestInner1:
extends BeforeAfterCounterTest
func test_passing():
assert_eq(1, 1, '1 = 1')
class TestInner2:
extends BeforeAfterCounterTest
func test_passing():
assert_eq(2, 2, '2 = 2')

View File

@@ -0,0 +1,13 @@
extends "res://addons/gut/test.gd"
func test_one():
pass
func test_two():
pass
func not_prefixed():
pass
func diff_prefix_something():
pass

View File

@@ -0,0 +1 @@
uid://dmsj68r58obck

View File

@@ -0,0 +1,7 @@
extends "res://addons/gut/test.gd"
func before_each():
gut.p("ran before_each", 2)
func test_assert_eq_number_not_equal():
assert_eq(1, 2, "Should fail. 1 != 2")

View File

@@ -0,0 +1,19 @@
# This file should be ignored by add_script since it does not extend GutTest
func before_all():
print("should be ignored")
# This class matches the default prefix but should be ignored because it does
# not extend GutTest
class TestDoesNotExtendTest:
func before_all():
print("should be ignored")
# This class should be ignored because the outer script does not extend GutTest.
class TestExtendsButShouldBeIgnored:
extends GutTest
func before_all():
print("should be ignored")

View File

@@ -0,0 +1 @@
uid://capxuhdpgydxr

View File

@@ -0,0 +1,44 @@
extends "res://addons/gut/test.gd"
func before_all():
gut.p('script: pre-run')
func before_each():
gut.p('script: setup')
func after_each():
gut.p('script: teardown')
func after_all():
gut.p('script: post-run')
func test_something():
assert_true(true)
func test_nothing():
assert_true(false)
class TestClass1:
extends "res://addons/gut/test.gd"
func before_all():
gut.p('TestClass1: pre-run')
func before_each():
gut.p('TestClass1: setup')
func after_each():
gut.p('TestClass1: teardown')
func after_all():
gut.p('TestClass1: post-run')
func test_context1_one():
assert_true(true)
func test_context1_two():
pending()
func test_failing():
assert_eq(2, 1)
func print_something():
print('hello world')
class NotTestClass:
func test_something():
pass
func not_a_test():
pass

View File

@@ -0,0 +1 @@
uid://cfshg7vvo3u43

View File

@@ -0,0 +1,19 @@
extends "res://addons/gut/test.gd"
class TestInner1:
extends "res://addons/gut/test.gd"
func test_passing():
assert_eq(1, 1, '1 = 1')
func test_passing2():
assert_eq(2, 2, '2 = 2')
class TestInner2:
extends "res://addons/gut/test.gd"
func test_failing():
assert_eq(1, 2, '1 != 2')
func test_failing2():
assert_eq(2, 3, '2 != 3')

View File

@@ -0,0 +1 @@
uid://yhn3cd1hqmp0

View File

@@ -0,0 +1,53 @@
# ##############################################################################
#All the magic happens with the extends. This gets you access to all the gut
#asserts and the overridable setup and teardown methods.
#
#The path to this script is passed to an instance of the gut script when calling
#test_script
#
#WARNING
# DO NOT assign anything to the gut variable. This is set at runtime by the gut
# script. Setting it to something will cause everything to go crazy go nuts.
# ##############################################################################
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")
func test_show_a_gut_print():
#This is what you should use to print out stuff if
#you want to see it in context of the test that it
#ran in.
gut.p("HELLO WORLD")
#display different info based on log level. Default
#level is 0, which means it will always show up.
#Notice, that since this prints something at level 0
#it will always be printed even when the log level
#is set to print only failures.
gut.p("log 0", 0)
gut.p("log 1", 1)
gut.p("log 2", 2)

View File

@@ -0,0 +1 @@
uid://bsjyq3r2q75md

View File

@@ -0,0 +1,53 @@
# ##############################################################################
#All the magic happens with the extends. This gets you access to all the gut
#asserts and the overridable setup and teardown methods.
#
#The path to this script is passed to an instance of the gut script when calling
#test_script
#
#WARNING
# DO NOT assign anything to the gut variable. This is set at runtime by the gut
# script. Setting it to something will cause everything to go crazy go nuts.
# ##############################################################################
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")
func test_show_a_gut_print():
#This is what you should use to print out stuff if
#you want to see it in context of the test that it
#ran in.
gut.p("HELLO WORLD")
#display different info based on log level. Default
#level is 0, which means it will always show up.
#Notice, that since this prints something at level 0
#it will always be printed even when the log level
#is set to print only failures.
gut.p("log 0", 0)
gut.p("log 1", 1)
gut.p("log 2", 2)

Some files were not shown because too many files have changed in this diff Show More