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(non_snake_case)]

/*   Unit tests for parsing arguments into MacroArgumentsAR.   */
/*   Used for str_array! macro                                */

use super::MacroArgumentsAR as MacroArguments;

#[test]
fn empty() {
   let rc = syn::parse_str::<MacroArguments>(r"");
   assert! ( rc.is_err() );
}

#[test]
fn Ident() {
   let rc = syn::parse_str::<MacroArguments>(r"hajo");
   assert! ( rc.is_err() );
}

#[test]
fn IdentComma() {
   let rc = syn::parse_str::<MacroArguments>(r#"hajo , "#);
   assert! (rc.is_err());
}

#[test]
fn IdentCommaStr() {
   let rc = syn::parse_str::<MacroArguments>(r#" hajo , "hajohere" "#);
   eprintln!("parse result is {:?}", rc);
   assert! (rc.is_ok());
   let rc: MacroArguments = rc.unwrap();
   assert_eq! ( rc.id, "hajo" );
   assert_eq! ( rc.content, "hajohere" );
   assert! ( rc.len.is_none() );
}

#[test]
fn IdentCommaStrComma() {
   let rc = syn::parse_str::<MacroArguments>(r#" hajo , "hajohere" , "#);
   eprintln!("parse result is {:?}", rc);
   assert! (rc.is_err());
}

#[test]
fn IdentCommaStrCommaUsize() {
   let rc = syn::parse_str::<MacroArguments>(r#" hajo , "hajohere" , 43 "#);
   eprintln!("parse result is {:?}", rc);
   assert! (rc.is_ok());
   let rc: MacroArguments = rc.unwrap();
   assert_eq! ( rc.id, "hajo" );
   assert_eq! ( rc.content, "hajohere" );
   assert_eq! ( rc.len.unwrap(), 43 );
}

#[test]
fn IdentCommaStrCommaNegativesize() {
   let rc = syn::parse_str::<MacroArguments>(r#" hajo , "hajohere" , -43 "#);
   eprintln!("parse result is {:?}", rc);
   assert! (rc.is_err());
}

#[test]
fn IdentCommaStrCommaFloat() {
   let rc = syn::parse_str::<MacroArguments>(r#" hajo , "hajohere" , -5.32 "#);
   eprintln!("parse result is {:?}", rc);
   assert! (rc.is_err());
}