-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework integration tests: self-registering #[itest]
, Rust runner
#142
Conversation
More uniform codebase, static typing, faster test execution.
tryBuild succeeded: |
# Conflicts: # itest/rust/src/lib.rs # itest/rust/src/variant_test.rs
1c6a830
to
5d6218f
Compare
bors r+ |
Build succeeded: |
@@ -148,6 +149,32 @@ pub fn default_call_error() -> GDExtensionCallError { | |||
} | |||
} | |||
|
|||
#[doc(hidden)] | |||
#[inline] | |||
pub fn panic_on_call_error(err: &GDExtensionCallError) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little late, but this seems like a great candidate for using #[track_caller]
, doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great advice, thanks! I was actually considering to make it a macro for this very reason, but totally forgot about this attribute 👍
No worries about "late", 2nd round of test improvements already on the way 😎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested it btw, indeed it works and shows the occurrence of the panic (with RUST_BACKTRACE=0
) on the call site.
146: `#[itest(skip)]` + `#[itest(focus)]` r=Bromeon a=Bromeon Follow-up to #142. Two new test features: * `#[itest(skip)]` ignores the current test, and shows the number of skipped tests in a statistic at the end of the run. * This is better than empty tests with `// TODO` or commented-out tests, as it reminds you of the technical debt and gives an impression of its extents. * If at least one test is annotated with `#[itest(focus)]`, then _only_ "focused" tests are run. * Extremely helpful during debugging sessions, or when one is working on a very particular feature. * If Godot is invoked with `-- --disallow-focus`, focus runs will always fail (for CI, to avoid accidental disabling of tests). This is not yet implemented for GDScript. Might be worth it, or might not. Apart from that, this PR massively simplifies the internal APIs to parse `#[attribute(key, key2="value")]` attributes. Co-authored-by: Jan Haller <bromeon@gmail.com>
Main changes:
#[itest]
is now self-registering, just like Rust's#[test]
.ok &= test_xy();
shenanigans. When declared, it runs.expect_panic
, reducing the stdout spam during integration tests.And unrelated to testing, but needed for this PR:
Variant::call()
method