diff options
author | 2018-09-06 01:04:39 +0200 | |
---|---|---|
committer | 2018-09-06 01:04:39 +0200 | |
commit | bc526b8d74cb548c9da8d5c10d6013008e164ba5 (patch) | |
tree | ff1097f2fd427ae20c3ddb4a53db9d29c5bc649c /cortex-m-rt/macros/src/lib.rs | |
parent | 306c3fbb7e9f186a43c0a82c43b6a1f16b88df98 (diff) | |
download | cortex-m-bc526b8d74cb548c9da8d5c10d6013008e164ba5.tar.gz cortex-m-bc526b8d74cb548c9da8d5c10d6013008e164ba5.tar.zst cortex-m-bc526b8d74cb548c9da8d5c10d6013008e164ba5.zip |
add compile-fail tests for passing arguments to the attributes
Diffstat (limited to 'cortex-m-rt/macros/src/lib.rs')
-rw-r--r-- | cortex-m-rt/macros/src/lib.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs index e37eb9c..da21954 100644 --- a/cortex-m-rt/macros/src/lib.rs +++ b/cortex-m-rt/macros/src/lib.rs @@ -92,9 +92,8 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream { "`#[entry]` function must have signature `fn() -> !`" ); - assert_eq!( - args.to_string(), - "", + assert!( + args.to_string() == "", "`entry` attribute must have no arguments" ); @@ -250,9 +249,8 @@ pub fn entry(args: TokenStream, input: TokenStream) -> TokenStream { pub fn exception(args: TokenStream, input: TokenStream) -> TokenStream { let f: ItemFn = syn::parse(input).expect("`#[exception]` must be applied to a function"); - assert_eq!( - args.to_string(), - "", + assert!( + args.to_string() == "", "`exception` attribute must have no arguments" ); @@ -473,9 +471,8 @@ pub fn pre_init(args: TokenStream, input: TokenStream) -> TokenStream { "`#[pre_init]` function must have signature `unsafe fn()`" ); - assert_eq!( - args.to_string(), - "", + assert!( + args.to_string() == "", "`pre_init` attribute must have no arguments" ); |