From 45db92e6be02a8913560bf40f3ab0c9f0b1be0dd Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Sun, 10 Nov 2019 23:43:28 +0100 Subject: [PATCH] [lang2/macro] add conflicting ink! marker test The conflict here is the additional #[ink(event)] marker --- lang2/macro/tests/compile_tests.rs | 1 + .../ui/fail/17-conflicting-ink-markers.rs | 20 +++++++++++++++++++ .../ui/fail/17-conflicting-ink-markers.stderr | 5 +++++ 3 files changed, 26 insertions(+) create mode 100644 lang2/macro/tests/ui/fail/17-conflicting-ink-markers.rs create mode 100644 lang2/macro/tests/ui/fail/17-conflicting-ink-markers.stderr diff --git a/lang2/macro/tests/compile_tests.rs b/lang2/macro/tests/compile_tests.rs index 51562c4f..43118b88 100644 --- a/lang2/macro/tests/compile_tests.rs +++ b/lang2/macro/tests/compile_tests.rs @@ -40,4 +40,5 @@ fn compile_tests() { t.compile_fail("tests/ui/fail/14-missing-storage-struct.rs"); t.compile_fail("tests/ui/fail/15-multiple-storage-structs.rs"); t.compile_fail("tests/ui/fail/16-storage-impl-ident-conflict.rs"); + t.compile_fail("tests/ui/fail/17-conflicting-ink-markers.rs"); } diff --git a/lang2/macro/tests/ui/fail/17-conflicting-ink-markers.rs b/lang2/macro/tests/ui/fail/17-conflicting-ink-markers.rs new file mode 100644 index 00000000..2f40bba2 --- /dev/null +++ b/lang2/macro/tests/ui/fail/17-conflicting-ink-markers.rs @@ -0,0 +1,20 @@ +#![feature(proc_macro_hygiene)] + +use ink_lang2 as ink; + +#[ink::contract(version = "0.1.0")] +mod noop { + #[ink(storage)] + #[ink(event)] // We cannot have #[ink(event)] if we already have #[ink(storage)] + struct Noop {} + + impl Noop { + #[ink(constructor)] + fn new(&mut self) {} + + #[ink(message)] + fn noop(&self) {} + } +} + +fn main() {} diff --git a/lang2/macro/tests/ui/fail/17-conflicting-ink-markers.stderr b/lang2/macro/tests/ui/fail/17-conflicting-ink-markers.stderr new file mode 100644 index 00000000..2367c913 --- /dev/null +++ b/lang2/macro/tests/ui/fail/17-conflicting-ink-markers.stderr @@ -0,0 +1,5 @@ +error: invalid ink! attribute found for `#[ink(storage)]` struct + --> $DIR/17-conflicting-ink-markers.rs:8:10 + | +8 | #[ink(event)] // We cannot have #[ink(event)] if we already have #[ink(storage)] + | ^^^^^^^ -- GitLab