File size: 1,059 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
//! Tests for the `#[derive(TaskInput)]` macro are in `turbo_tasks` itself.
//! However, we keep one test here as an integration test between the derive
//! macro and the `#[turbo_tasks::function]` macro.
#![allow(clippy::needless_return)] // tokio macro-generated code doesn't respect this
use serde::{Deserialize, Serialize};
use turbo_tasks::{Completion, ReadRef, TaskInput, Vc, trace::TraceRawVcs};
use turbo_tasks_testing::{Registration, register, run};
static REGISTRATION: Registration = register!();
#[derive(Clone, TaskInput, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, TraceRawVcs)]
struct OneUnnamedField(u32);
#[turbo_tasks::function]
fn one_unnamed_field(input: OneUnnamedField) -> Vc<Completion> {
assert_eq!(input.0, 42);
Completion::immutable()
}
#[tokio::test]
async fn tests() {
run(®ISTRATION, || async {
assert!(ReadRef::ptr_eq(
&one_unnamed_field(OneUnnamedField(42)).await?,
&Completion::immutable().await?,
));
anyhow::Ok(())
})
.await
.unwrap()
}
|