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 MacroArgumentsRP   */
/*   Used for str_repeat! macro */

use super::MacroArgumentsRP 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 StrComma() {
   let rc = syn::parse_str::<MacroArguments>(r#" "hajo", "#);
   assert! (rc.is_err());
}

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

#[test]
fn ByteStrCommaInt() {
   let rc = syn::parse_str::<MacroArguments>(r#" b"hajo" , 5 "#);
   eprintln!("parse result is {:?}", rc);
   assert! (rc.is_ok());
   let rc: MacroArguments = rc.unwrap();
   assert_eq! ( rc.content, &b"hajo"[..] );
   assert_eq! ( rc.times, 5 );
}

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