Commit 71f62058 authored by Robin Freyler's avatar Robin Freyler

[lang2/macro] add ui test for storage-impl conflict

parent a96f594d
......@@ -39,4 +39,5 @@ fn compile_tests() {
t.compile_fail("tests/ui/fail/13-abi-constructor.rs");
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");
}
#![feature(proc_macro_hygiene)]
use ink_lang2 as ink;
#[ink::contract(version = "0.1.0")]
mod noop {
// This test ensures that ink! impl blocks are always
// implemented on the only storage struct definition.
#[ink(storage)]
struct StorageStruct {}
// This ink! impl block is okay.
impl StorageStruct {
#[ink(constructor)]
fn new1(&mut self) {}
#[ink(message)]
fn do_something1(&self) {}
}
// Missing the #[ink(storage)] attribute on purpose.
struct NonStorageStruct {}
// This ink! impl block is invalid in that it implement
// the messages and constructors for a non-existing ink!
// storage struct. We expect a failure here.
impl NonStorageStruct {
#[ink(constructor)]
fn new2(&mut self) {}
#[ink(message)]
fn do_something2(&self) {}
}
}
fn main() {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment