26 lines
767 B
Rust
26 lines
767 B
Rust
extern crate proc_macro;
|
|
|
|
mod codegen;
|
|
mod parse;
|
|
|
|
use proc_macro::TokenStream;
|
|
|
|
/// Test DSL for pikl-menu. Generates individual test
|
|
/// functions from a concise block-based syntax.
|
|
///
|
|
/// Supported test kinds:
|
|
/// - `headless`: integration tests that spawn the pikl binary
|
|
/// - `filter`: unit tests for fuzzy filter matching
|
|
/// - `nav`: unit tests for viewport/cursor math
|
|
/// - `menu`: async unit tests for the menu state machine
|
|
///
|
|
/// See the project's test files for usage examples.
|
|
#[proc_macro]
|
|
pub fn pikl_tests(input: TokenStream) -> TokenStream {
|
|
let parsed = syn::parse_macro_input!(input as parse::PiklTests);
|
|
match codegen::generate(&parsed) {
|
|
Ok(tokens) => tokens.into(),
|
|
Err(err) => err.to_compile_error().into(),
|
|
}
|
|
}
|