cranpose-macros 0.1.168

Procedural macros for Cranpose
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::*;

#[test]
fn definition_key_does_not_monomorphise_the_once_lock_initializer() {
    let core_path = quote!(::cranpose_core);
    let ident = Ident::new("__cranpose_caller_key", Span::mixed_site());
    let tokens = definition_key_stmt(&core_path, &ident).to_string();

    assert!(
        tokens.contains("cached_composable_definition_key"),
        "the definition key must be latched through the outlined core \
         helper, got: {tokens}"
    );
    assert!(
        !tokens.contains("get_or_init"),
        "no initializer closure may reach the expansion site, got: {tokens}"
    );
}