Skip to content
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

Merged
merged 2 commits into from
Jul 25, 2024
Merged

Reduce macro usage in turbo-tasks-testing #8832

merged 2 commits into from
Jul 25, 2024

Conversation

bgw
Copy link
Member

@bgw bgw commented Jul 24, 2024

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

Copy link

vercel bot commented Jul 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2024 6:17pm
rust-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2024 6:17pm
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 6:17pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 6:17pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 6:17pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 6:17pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 6:17pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 6:17pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 6:17pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Jul 25, 2024 6:17pm

Copy link
Member Author

bgw commented Jul 24, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @bgw and the rest of your teammates on Graphite Graphite

Copy link
Contributor

github-actions bot commented Jul 24, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

✅ This change can build next-swc

Copy link
Contributor

github-actions bot commented Jul 24, 2024

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

Copy link
Contributor

@arlyon arlyon left a 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!

Copy link
Contributor

@arlyon arlyon left a 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 👍

Copy link
Contributor

@arlyon arlyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

bgw added 2 commits July 25, 2024 11:14
Changes the `run` macro into a function.
Copy link
Member Author

bgw commented Jul 25, 2024

Merge activity

  • Jul 25, 2:43 PM EDT: @bgw merged this pull request with Graphite.

@bgw bgw deleted the bgw/test-run-no-macro branch July 25, 2024 18:43
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
## 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
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
## 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
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
## 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
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
## 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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants