Skip to content

Commit b4ec488

Browse files
committed
Remove explicit calls to tests, now handled by #[itest] auto-registration
1 parent 6f97d36 commit b4ec488

19 files changed

+13
-287
lines changed

itest/rust/src/array_test.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,6 @@
77
use crate::{expect_panic, itest};
88
use godot::prelude::*;
99

10-
pub fn run() -> bool {
11-
let mut ok = true;
12-
ok &= array_default();
13-
ok &= array_new();
14-
ok &= array_eq();
15-
ok &= typed_array_from_to_variant();
16-
ok &= untyped_array_from_to_variant();
17-
ok &= array_from_packed_array();
18-
ok &= array_from_iterator();
19-
ok &= array_from_slice();
20-
ok &= array_try_into_vec();
21-
ok &= array_iter_shared();
22-
ok &= array_hash();
23-
ok &= array_share();
24-
ok &= array_duplicate_shallow();
25-
ok &= array_duplicate_deep();
26-
ok &= array_slice_shallow();
27-
ok &= array_slice_deep();
28-
ok &= array_get();
29-
ok &= array_first_last();
30-
ok &= array_binary_search();
31-
ok &= array_find();
32-
ok &= array_rfind();
33-
ok &= array_min_max();
34-
ok &= array_pick_random();
35-
ok &= array_set();
36-
ok &= array_push_pop();
37-
ok &= array_insert();
38-
ok &= array_extend();
39-
ok &= array_reverse();
40-
ok &= array_sort();
41-
ok &= array_shuffle();
42-
ok &= array_mixed_values();
43-
ok &= untyped_array_pass_to_godot_func();
44-
ok &= untyped_array_return_from_godot_func();
45-
ok &= typed_array_pass_to_godot_func();
46-
ok &= typed_array_return_from_godot_func();
47-
ok
48-
}
49-
5010
#[itest]
5111
fn array_default() {
5212
assert_eq!(Array::default().len(), 0);

itest/rust/src/base_test.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@
77
use crate::itest;
88
use godot::prelude::*;
99

10-
pub(crate) fn run() -> bool {
11-
let mut ok = true;
12-
ok &= base_instance_id();
13-
ok &= base_deref();
14-
ok &= base_display();
15-
ok &= base_debug();
16-
ok &= base_with_init();
17-
18-
ok
19-
}
20-
2110
/*
2211
#[itest]
2312
fn base_test_is_weak() {

itest/rust/src/builtin_test.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ use crate::itest;
88
use godot::builtin::inner::*;
99
use godot::prelude::*;
1010

11-
pub(crate) fn run() -> bool {
12-
let mut ok = true;
13-
ok &= test_builtins_vector2();
14-
ok &= test_builtins_array();
15-
ok &= test_builtins_callable();
16-
ok
17-
}
18-
1911
#[itest]
2012
fn test_builtins_vector2() {
2113
let vec = Vector2::new(3.0, -4.0);

itest/rust/src/codegen_test.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ use godot::builtin::inner::{InnerColor, InnerString};
1212
use godot::engine::{FileAccess, HttpRequest};
1313
use godot::prelude::*;
1414

15-
pub fn run() -> bool {
16-
let mut ok = true;
17-
ok &= codegen_class_renamed();
18-
ok &= codegen_base_renamed();
19-
ok &= codegen_static_builtin_method();
20-
ok &= codegen_static_class_method();
21-
ok
22-
}
23-
2415
#[itest]
2516
fn codegen_class_renamed() {
2617
// Known as `HTTPRequest` in Godot

itest/rust/src/color_test.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@
77
use crate::itest;
88
use godot::builtin::{Color, ColorChannelOrder};
99

10-
pub fn run() -> bool {
11-
let mut ok = true;
12-
ok &= color_from_rgba8();
13-
ok &= color_from_u32();
14-
ok &= color_from_u64();
15-
ok &= color_from_html();
16-
ok &= color_from_string();
17-
ok &= color_get_set_u8();
18-
ok &= color_blend();
19-
ok &= color_to_u32();
20-
ok &= color_to_u64();
21-
ok
22-
}
23-
2410
#[itest]
2511
fn color_from_rgba8() {
2612
assert_eq!(

itest/rust/src/dictionary_test.rs

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,8 @@
77
use std::collections::{HashMap, HashSet};
88

99
use crate::{expect_panic, itest};
10-
use godot::{
11-
builtin::{dict, varray, Dictionary, FromVariant, ToVariant},
12-
prelude::{Share, Variant},
13-
};
14-
15-
pub fn run() -> bool {
16-
let mut ok = true;
17-
ok &= dictionary_default();
18-
ok &= dictionary_new();
19-
ok &= dictionary_from_iterator();
20-
ok &= dictionary_from();
21-
ok &= dictionary_macro();
22-
ok &= dictionary_clone();
23-
ok &= dictionary_duplicate_deep();
24-
ok &= dictionary_hash();
25-
ok &= dictionary_get();
26-
ok &= dictionary_insert();
27-
ok &= dictionary_insert_multiple();
28-
ok &= dictionary_insert_long();
29-
ok &= dictionary_extend();
30-
ok &= dictionary_remove();
31-
ok &= dictionary_clear();
32-
ok &= dictionary_find_key();
33-
ok &= dictionary_contains_keys();
34-
ok &= dictionary_keys_values();
35-
ok &= dictionary_equal();
36-
ok &= dictionary_iter();
37-
ok &= dictionary_iter_equals_big();
38-
ok &= dictionary_iter_insert();
39-
ok &= dictionary_iter_insert_after_completion();
40-
ok &= dictionary_iter_big();
41-
ok &= dictionary_iter_simultaneous();
42-
ok &= dictionary_iter_panics();
43-
ok &= dictionary_iter_clear();
44-
ok &= dictionary_iter_erase();
45-
ok
46-
}
10+
use godot::builtin::{dict, varray, Dictionary, FromVariant, ToVariant, Variant};
11+
use godot::obj::Share;
4712

4813
#[itest]
4914
fn dictionary_default() {

itest/rust/src/enum_test.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ use godot::engine::input::CursorShape;
99
use godot::engine::time;
1010
use std::collections::HashSet;
1111

12-
pub fn run() -> bool {
13-
let mut ok = true;
14-
ok &= enum_ords_correct();
15-
ok &= enum_equality();
16-
ok &= enum_hash();
17-
ok
18-
}
19-
2012
#[itest]
2113
fn enum_ords_correct() {
2214
use godot::obj::EngineEnum;

itest/rust/src/export_test.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66

77
use godot::prelude::*;
88

9-
pub(crate) fn run() -> bool {
10-
// No tests currently, tests using HasProperty are in Godot scripts.
11-
12-
true
13-
}
9+
// No tests currently, tests using HasProperty are in Godot scripts.
1410

1511
#[derive(GodotClass)]
1612
#[class(base=Node)]

itest/rust/src/gdscript_ffi_test.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,3 @@
99
#[rustfmt::skip]
1010
#[path = "gen/gen_ffi.rs"]
1111
mod gen_ffi;
12-
13-
pub(crate) fn run() -> bool {
14-
true
15-
}

itest/rust/src/lib.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ sys::plugin_registry!(__GODOT_ITEST: TestCase);
5656
// }
5757

5858
fn run_tests() -> bool {
59-
let mut ok = true;
60-
6159
let mut tests: Vec<TestCase> = vec![];
6260

6361
sys::plugin_foreach!(__GODOT_ITEST; |test: &TestCase| {
@@ -68,7 +66,6 @@ fn run_tests() -> bool {
6866

6967

7068
let mut stats = TestStats::default();
71-
7269
for test in tests {
7370
stats.tests_run += 1;
7471
if run_test(&test) {
@@ -82,6 +79,9 @@ fn run_tests() -> bool {
8279
// ----------------------------------------------------------------------------------------------------------------------------------------------
8380
// Implementation
8481

82+
#[gdextension(entry_point=itest_init)]
83+
unsafe impl ExtensionLibrary for IntegrationTests {}
84+
8585
#[derive(GodotClass, Debug)]
8686
#[class(base=Node, init)]
8787
struct IntegrationTests {}
@@ -95,13 +95,17 @@ impl IntegrationTests {
9595
}
9696
}
9797

98-
#[gdextension(entry_point=itest_init)]
99-
unsafe impl ExtensionLibrary for IntegrationTests {}
100-
10198
pub(crate) fn expect_panic(context: &str, code: impl FnOnce() + UnwindSafe) {
10299
let panic = std::panic::catch_unwind(code);
103100
assert!(
104101
panic.is_err(),
105102
"code should have panicked but did not: {context}",
106103
);
107104
}
105+
106+
#[derive(Default)]
107+
struct TestStats {
108+
tests_run: usize,
109+
tests_passed: usize,
110+
tests_skipped: usize,
111+
}

0 commit comments

Comments
 (0)