Skip to main content

test

Attribute Macro test 

Source
#[test]
Expand description

Marks an async function as a Camber test.

Sets up a multi-thread Tokio runtime with Camber context installed. The test body runs as an async block inside camber::runtime::__test_async.

#[camber::test]
async fn my_test() {
    let handle = camber::spawn_async(async { 42 });
    assert_eq!(handle.await.unwrap(), 42);
}