-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Thank you for the fantastic crate!
I succesfully use ctor in order to initialize my tests, notably I initialize color_eyre, which makes output much prettier:
#[cfg(test)]
mod tests {
use crate::utils::global_init::global_init;
use ctor::ctor;
#[ctor]
fn init() {
global_init();
}
}However, it does not work for doctests. I tried various permutations of things, none worked - the function is not called. Some of my attempts on Ubuntu 22.04:
#[cfg(doctest)]
mod tests {
use crate::utils::global_init::global_init;
use ctor::ctor;
#[ctor]
fn init() {
global_init();
}
}#[cfg(any(test, doctest))]
mod tests {
use crate::utils::global_init::global_init;
use ctor::ctor;
#[ctor]
fn init() {
global_init();
}
}#[cfg(doctest)]
#[ctor::ctor]
fn init() {
utils::global_init::global_init();
}Have anyone managed to run ctor with for doctests? Please share your experience.
Or is this something that ctor does not support, perhaps due to technical limitations?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels