Attribute Macro test

Source
#[test]
Expand description

Marks an async function as a tanu test case.

This attribute registers the function with tanu’s test discovery system, making it available for execution via the test runner.

§Basic Usage

#[tanu::test]
async fn my_test() -> eyre::Result<()> {
    // Test implementation
    Ok(())
}

§Parameterized Tests

The macro supports parameterized testing by accepting arguments:

#[tanu::test(200)]
#[tanu::test(404)]
#[tanu::test(500)]
async fn test_status_codes(status: u16) -> eyre::Result<()> {
    // Test with different status codes
    Ok(())
}

§Requirements

  • Function must be async
  • Function must return a Result<T, E> type
  • Supported Result types: eyre::Result, anyhow::Result, std::result::Result

§Error Handling

The macro automatically handles different Result types and integrates with tanu’s error reporting system for enhanced error messages and backtraces.