From 6a8fb450b5ac3e365455abe783757b7376bd1b08 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 12 Nov 2022 20:21:21 +0100 Subject: test: replace the test_util_macros crate with utility-macros --- test_util_macros/src/lib.rs | 47 --------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 test_util_macros/src/lib.rs (limited to 'test_util_macros/src') diff --git a/test_util_macros/src/lib.rs b/test_util_macros/src/lib.rs deleted file mode 100644 index aa87ecf..0000000 --- a/test_util_macros/src/lib.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![deny(clippy::all)] -#![deny(clippy::pedantic)] -#![deny(missing_docs)] - -//! Internal macros used by tests. - -use std::iter::repeat; - -use proc_macro::TokenStream; -use quote::quote; -use syn::parse::Parse; -use syn::{parse_macro_input, LitChar, LitInt, Token}; - -/// Repeats a character N number of times. -#[proc_macro] -pub fn repeat_char(input: TokenStream) -> TokenStream -{ - let RepeatMacroArgs { character, count } = - parse_macro_input!(input as RepeatMacroArgs); - - let repeated = repeat(character.value()).take(count).collect::(); - - quote! { - #repeated - } - .into() -} - -struct RepeatMacroArgs -{ - character: LitChar, - count: usize, -} - -impl Parse for RepeatMacroArgs -{ - fn parse(input: syn::parse::ParseStream) -> syn::Result - { - let character = input.parse::()?; - - input.parse::()?; - - let count = input.parse::()?.base10_parse::()?; - - Ok(Self { character, count }) - } -} -- cgit v1.2.3-18-g5258