-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Reduce macro usage in turbo-tasks-testing #8832
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
8 Skipped Deployments
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
🟢 Turbopack Benchmark CI successful 🟢Thanks |
✅ This change can build |
|
a0f10c1
to
2085efb
Compare
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.
Yay no lazy_static!
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.
Also very much for unwraps in tests 👍
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.
Nice!
Changes the `run` macro into a function.
8dc3955
to
44e639e
Compare
## What? Replaces the `turbo_tasks_testing::run!` macro with a `run` function that requires an opaque registration argument generated by the `register!` macro. ## Why? A few reasons: - `cargo fmt` doesn't work inside macros (with the exception of function-like macros), so our tests weren't getting autoformatted. - When a test fails, it was hard to know what line it failed on, because the failure is attributed to the first line of the macro usage. ## Related Changes - This also changes many (though not all) `.await?`s into `.await.unwrap()`s. The reason for this is similar: it's easier to attribute the line that causes a panic than the line that returns an error. I left some tests alone as there were more `?`s than I felt like changing. - `register!()` now takes an optional list of other register functions to call. The tests in `turbo-tasks-fetch` use this. ## Testing Instructions ``` cargo nextest run ```
## What? Replaces the `turbo_tasks_testing::run!` macro with a `run` function that requires an opaque registration argument generated by the `register!` macro. ## Why? A few reasons: - `cargo fmt` doesn't work inside macros (with the exception of function-like macros), so our tests weren't getting autoformatted. - When a test fails, it was hard to know what line it failed on, because the failure is attributed to the first line of the macro usage. ## Related Changes - This also changes many (though not all) `.await?`s into `.await.unwrap()`s. The reason for this is similar: it's easier to attribute the line that causes a panic than the line that returns an error. I left some tests alone as there were more `?`s than I felt like changing. - `register!()` now takes an optional list of other register functions to call. The tests in `turbo-tasks-fetch` use this. ## Testing Instructions ``` cargo nextest run ```
## What? Replaces the `turbo_tasks_testing::run!` macro with a `run` function that requires an opaque registration argument generated by the `register!` macro. ## Why? A few reasons: - `cargo fmt` doesn't work inside macros (with the exception of function-like macros), so our tests weren't getting autoformatted. - When a test fails, it was hard to know what line it failed on, because the failure is attributed to the first line of the macro usage. ## Related Changes - This also changes many (though not all) `.await?`s into `.await.unwrap()`s. The reason for this is similar: it's easier to attribute the line that causes a panic than the line that returns an error. I left some tests alone as there were more `?`s than I felt like changing. - `register!()` now takes an optional list of other register functions to call. The tests in `turbo-tasks-fetch` use this. ## Testing Instructions ``` cargo nextest run ```
## What? Replaces the `turbo_tasks_testing::run!` macro with a `run` function that requires an opaque registration argument generated by the `register!` macro. ## Why? A few reasons: - `cargo fmt` doesn't work inside macros (with the exception of function-like macros), so our tests weren't getting autoformatted. - When a test fails, it was hard to know what line it failed on, because the failure is attributed to the first line of the macro usage. ## Related Changes - This also changes many (though not all) `.await?`s into `.await.unwrap()`s. The reason for this is similar: it's easier to attribute the line that causes a panic than the line that returns an error. I left some tests alone as there were more `?`s than I felt like changing. - `register!()` now takes an optional list of other register functions to call. The tests in `turbo-tasks-fetch` use this. ## Testing Instructions ``` cargo nextest run ```
What?
Replaces the
turbo_tasks_testing::run!
macro with arun
function that requires an opaque registration argument generated by theregister!
macro.Why?
A few reasons:
cargo fmt
doesn't work inside macros (with the exception of function-like macros), so our tests weren't getting autoformatted.Related Changes
This also changes many (though not all)
.await?
s into.await.unwrap()
s. The reason for this is similar: it's easier to attribute the line that causes a panic than the line that returns an error. I left some tests alone as there were more?
s than I felt like changing.register!()
now takes an optional list of other register functions to call. The tests inturbo-tasks-fetch
use this.Testing Instructions