Skip to main content

pdk_test_macros/
lib.rs

1// Copyright (c) 2026, Salesforce, Inc.,
2// All rights reserved.
3// For full license text, see the LICENSE.txt file
4
5//! PDK Test Macros
6//!
7//! This module provides the macros to declare functions as tests in the pdk-test framework.
8
9use proc_macro::TokenStream;
10
11mod emit;
12
13#[proc_macro_attribute]
14/// Use this macro to annotate your test functions as PDK tests.
15/// ```rust
16/// #[pdk_test]
17/// async fn token_from_header() -> anyhow::Result<()> {
18///     ...
19/// }
20/// ```
21pub fn pdk_test(meta: TokenStream, input: TokenStream) -> TokenStream {
22    emit::emit_test(meta.into(), input.into())
23        .unwrap_or_else(syn::Error::into_compile_error)
24        .into()
25}