You don't need to use test_status anymore :3

This commit is contained in:
JeremyStar™ 2024-03-28 17:06:29 +01:00
parent e0d8f0d125
commit 239bd24ec8
2 changed files with 20 additions and 13 deletions

View file

@ -43,7 +43,7 @@ extends BessereTestsTest
# You can name this whatever you want as long as the function is prefixed with 'test_'.
# If not, it will not be run.
func test_example() -> void:
# Logging examples
# Logging examples
ldiag("DIAGNOSTIC MESSAGE")
lverb("VERBOSE MESSAGE")
linfo("INFORMATIONAL MESSAGE")
@ -51,24 +51,17 @@ func test_example() -> void:
lerror("ERROR MESSAGE")
#await lcrash("Something horrible happened") # Must be awaited, uncomment for a little nuke
# Test result (must be set or Bessere Tests will complain)
# -> Test status
# Can be either 0 (ok), 1 (warn), 2 (error) or 3 (skip). Any other value will be marked as invalid.
test_status = 0
# -> Test message
# Can be set to any string you like, or can be unset.
# Would of course be useful to leave a message when 'test_status' is set to anything but 0.
test_message = "Hello Test!"
# Test result
# You can use `ok(message)`, `warn(message)`, `error(message)` or `skip(message)` to set your test result.
ok("Hello Test!")
# You can create multiple tests btw.
func test_proprietary_blob() -> void:
test_status = 2
test_message = "Not open source."
error("Not open source.")
# Some unimplemented test
func test_unimplemented() -> void:
test_status = 3
test_message = "TODO"
skip()
```
Use this example to build your tests. And remember: You can have multiple test files (we call them "test suites" or "suites" for short).

View file

@ -24,3 +24,17 @@ func linfo(message: String) -> void: rts.linfo(message, name + ":" + lfunc)
func lwarn(message: String) -> void: rts.lwarn(message, name + ":" + lfunc)
func lerror(message: String) -> void: rts.lerror(message, name + ":" + lfunc)
func lcrash(message: String) -> void: await rts.lcrash(message, name + ":" + lfunc)
# Easier results management
func rok(message: String = "") -> void:
test_status = 0
test_message = message
func rwarn(message: String = "") -> void:
test_status = 1
test_message = message
func rerror(message: String = "") -> void:
test_status = 2
test_message = message
func rskip(message: String = "") -> void:
test_status = 3
test_message = message