proc_strarray 1.7.0

Create const u8 array from str or byte str literal
Documentation
// Copyright 2024 Radim Kolar <hsn@sendmail.cz>
//
// SPDX-License-Identifier: MIT
// or
// SPDX-License-Identifier: Apache-2.0

#![allow(unused_imports)]
#![allow(dead_code)]

extern crate proc_macro;
use proc_macro::TokenStream;

use syn::parse_macro_input;

use super::str_array;

// proc macro testing seems to be problematic, can't be done in regular testsuite
// compiler won't allow use of proc_macro::TokenStream outside of macro function:
//
// thread 'tests::test1' panicked at library\proc_macro\src\bridge\client.rs:237:32:
// procedural macro API is used outside of a procedural macro

/** make token stream from string */
fn make_token_stream(input: impl AsRef<str>) -> TokenStream {
    let token_stream: TokenStream = <TokenStream as std::str::FromStr>::from_str(input.as_ref()).unwrap();
    token_stream
}

/** test macro invocation,
    panics
*/
#[test]
#[should_panic]
fn test1_panics() {
   let input = make_token_stream("kamala");
   let _output = str_array(input);
}