forked from godot-rust/gdext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Add integration tests.
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
extends ArrayTest | ||
|
||
var _assertion_failed: bool = false | ||
|
||
## Asserts that `what` is `true`, but does not abort the test. Returns `what` so you can return | ||
## early from the test function if the assertion failed. | ||
func assert_that(what: bool, message: String = "") -> bool: | ||
if what: | ||
return true | ||
|
||
_assertion_failed = true | ||
if message: | ||
print("assertion failed: %s" % message) | ||
else: | ||
print("assertion failed") | ||
return false | ||
|
||
func assert_eq(left, right, message: String = "") -> bool: | ||
if left == right: | ||
return true | ||
|
||
_assertion_failed = true | ||
if message: | ||
print("assertion failed: %s\n left: %s\n right: %s" % [message, left, right]) | ||
else: | ||
print("assertion failed: `(left == right)`\n left: %s\n right: %s" % [left, right]) | ||
return false | ||
|
||
|
||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
pass | ||
|
||
func test_vector_array_return_from_user_func(): | ||
var array: Array = return_typed_array(2) | ||
assert_eq(array, [1,2]) | ||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters