#![expect(clippy::todo, reason = "Tests use panicking operations for brevity and clarity")]
use fp_macros::{
document_module,
impl_kind,
trait_kind,
};
#[document_module(no_validation)]
mod test_mod {
use super::*;
trait_kind!(
type Of<T>;
);
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct MyBrand;
#[allow(dead_code, reason = "Test fixture exists to exercise document_module macro")]
pub struct MyType<T>(T);
impl_kind! {
for MyBrand {
#[document_default]
type Of<T> = MyType<T>;
}
}
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub trait Functor {
fn map<A, B>(
self,
f: impl Fn(A) -> B,
) -> MyType<B>;
}
impl Functor for MyBrand {
#[document_signature]
fn map<A, B>(
self,
_f: impl Fn(A) -> B,
) -> MyType<B> {
todo!()
}
}
}
#[test]
fn test_document_module_integration() {
}
#[test]
fn test_positional_matching() {
}
#[document_module(no_validation)]
mod test_collision {
use fp_macros::{
impl_kind,
trait_kind,
};
trait_kind!(
type Of<T>;
);
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct Brand;
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct MyType<T>(T);
impl_kind! {
for Brand {
type Of<A> = MyType<A>;
}
}
#[fp_macros::document_module]
#[expect(unexpected_cfgs, reason = "Testing cfg-gated items in document_module")]
mod test_cfg_no_conflict {
use fp_macros::impl_kind;
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct Brand;
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct SyncType<T>(T);
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct AsyncType<T>(T);
#[cfg(feature = "sync")]
impl_kind! {
#[no_inferable_brand]
for Brand {
type Of<T> = SyncType<T>;
}
}
#[cfg(not(feature = "sync"))]
impl_kind! {
#[no_inferable_brand]
for Brand {
type Of<T> = AsyncType<T>;
}
}
#[allow(
dead_code,
non_camel_case_types,
reason = "Test fixture exists to exercise document_module macro"
)]
trait Kind_ad6c20556a82a1f0 {
type Of<T>;
}
}
#[fp_macros::document_module]
mod test_dyn_formatting {
#[allow(dead_code, reason = "Test fixture exists to exercise document_module macro")]
pub trait MyTrait {}
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct Brand;
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub trait TestTrait {
#[document_signature]
fn foo() -> Box<dyn MyTrait>;
}
}
}
#[document_module(no_validation)]
mod test_erasure {
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct Brand;
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub trait MyTrait {
#[document_signature]
#[expect(
clippy::needless_lifetimes,
reason = "Testing lifetime handling in document_module macro"
)]
unsafe fn foo<'a, T: ?Sized>(x: &'a T) -> &'a T;
}
}
#[document_module(no_validation)]
mod test_impl_level_document_parameters {
use fp_macros::document_parameters;
#[allow(dead_code, reason = "Test fixture exists to exercise document_module macro")]
pub struct MyList<T>(Vec<T>);
#[document_type_parameters("The type of elements in the list")]
#[document_parameters("The list instance")]
impl<T> MyList<T> {
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[document_signature]
#[document_parameters]
pub fn len(&self) -> usize {
self.0.len()
}
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[document_signature]
#[document_parameters]
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[document_signature]
#[document_parameters("The element to append")]
pub fn push(
&mut self,
item: T,
) {
self.0.push(item)
}
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[document_signature]
#[document_parameters("The element to prepend")]
pub fn cons(
self,
item: T,
) -> Self {
let mut new_vec = vec![item];
new_vec.extend(self.0);
MyList(new_vec)
}
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[document_signature]
#[document_parameters("The initial capacity")]
pub fn with_capacity(capacity: usize) -> Self {
MyList(Vec::with_capacity(capacity))
}
}
#[document_parameters("The list to operate on")]
impl<T: Clone> MyList<T> {
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[document_signature]
#[document_parameters]
pub fn clone_list(&self) -> Self {
MyList(self.0.clone())
}
}
}
#[test]
fn test_impl_level_document_parameters_integration() {
}
#[document_module]
mod test_trait_fully_documented {
use fp_macros::{
document_examples,
document_parameters,
document_returns,
};
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[fp_macros::document_type_parameters("The element type.")]
#[document_parameters("The collection instance.")]
pub trait MyCollection<T> {
#[fp_macros::document_signature]
#[document_returns("The number of elements in the collection.")]
#[document_examples]
fn len(&self) -> usize;
#[fp_macros::document_signature]
#[document_parameters("The element to add.")]
#[document_returns("Whether the element was added.")]
#[document_examples]
fn add(
&mut self,
item: T,
) -> bool;
}
}
#[document_module]
mod test_marker_trait {
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub trait Marker {}
}
#[document_module(no_validation)]
mod test_trait_and_impl_together {
use fp_macros::document_parameters;
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub trait Greet {
#[document_signature]
fn greet(&self) -> String;
}
#[expect(dead_code, reason = "Test fixture for document_module macro")]
pub struct Greeter;
#[document_parameters("The greeter instance.")]
impl Greet for Greeter {
#[document_signature]
#[document_parameters]
fn greet(&self) -> String {
"hello".into()
}
}
}
#[document_module(no_validation)]
mod test_trait_level_document_parameters {
use fp_macros::document_parameters;
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[document_parameters("The stack instance.")]
pub trait Stack<T> {
#[document_parameters("The element to push.")]
fn push(
&mut self,
item: T,
);
#[document_parameters]
fn pop(&mut self) -> Option<T>;
}
}
#[test]
fn test_trait_support_integration() {
}
#[test]
fn test_trait_level_document_parameters_integration() {
}
#[document_module]
mod test_trait_signature_with_examples {
use fp_macros::{
document_examples,
document_returns,
};
#[expect(dead_code, reason = "Test fixture for document_module macro")]
#[document_examples]
pub trait Testable {
#[fp_macros::document_signature]
#[document_returns("A result.")]
#[document_examples]
fn do_thing() -> bool;
}
}
#[test]
fn test_trait_signature_with_examples() {
}