From 2ec3d9a931aa7a28195ab28229ae748c1ab9873a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Wed, 31 Mar 2021 10:06:03 +0200 Subject: [PATCH] Use `#[ink::test]` instead of `#[test]` (#112) * Use `#[ink::test]` instead of `#[test]` * Import `ink_lang` --- 1/assets/1.1-finished-code.rs | 5 ++++- 1/assets/1.2-finished-code.rs | 3 ++- 1/assets/1.2-template.rs | 3 ++- 1/assets/1.3-finished-code.rs | 3 ++- 1/assets/1.3-template.rs | 3 ++- 1/assets/1.4-finished-code.rs | 5 +++-- 1/assets/1.4-template.rs | 5 +++-- 1/assets/1.5-finished-code.rs | 4 ++-- 1/assets/1.5-template.rs | 4 ++-- 1/assets/1.6-finished-code.rs | 4 ++-- 1/assets/1.6-template.rs | 4 ++-- 11 files changed, 26 insertions(+), 17 deletions(-) diff --git a/1/assets/1.1-finished-code.rs b/1/assets/1.1-finished-code.rs index 6fa1218..1c9eea0 100644 --- a/1/assets/1.1-finished-code.rs +++ b/1/assets/1.1-finished-code.rs @@ -25,7 +25,10 @@ mod incrementer { #[cfg(test)] mod tests { - #[test] + use super::*; + use ink_lang as ink; + + #[ink::test] fn default_works() { // Test Your Contract } diff --git a/1/assets/1.2-finished-code.rs b/1/assets/1.2-finished-code.rs index 0bb4cfa..3ac95fb 100644 --- a/1/assets/1.2-finished-code.rs +++ b/1/assets/1.2-finished-code.rs @@ -34,8 +34,9 @@ mod incrementer { #[cfg(test)] mod tests { use super::*; + use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { Incrementer::default(); } diff --git a/1/assets/1.2-template.rs b/1/assets/1.2-template.rs index 496c01c..3d958bd 100644 --- a/1/assets/1.2-template.rs +++ b/1/assets/1.2-template.rs @@ -30,8 +30,9 @@ mod incrementer { #[cfg(test)] mod tests { use super::*; + use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { Incrementer::default(); } diff --git a/1/assets/1.3-finished-code.rs b/1/assets/1.3-finished-code.rs index 93e2114..359d444 100644 --- a/1/assets/1.3-finished-code.rs +++ b/1/assets/1.3-finished-code.rs @@ -35,8 +35,9 @@ mod incrementer { #[cfg(test)] mod tests { use super::*; + use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { let contract = Incrementer::default(); assert_eq!(contract.get(), 0); diff --git a/1/assets/1.3-template.rs b/1/assets/1.3-template.rs index c0d5a82..3b9cae7 100644 --- a/1/assets/1.3-template.rs +++ b/1/assets/1.3-template.rs @@ -36,8 +36,9 @@ mod incrementer { #[cfg(test)] mod tests { use super::*; + use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { let contract = Incrementer::default(); assert_eq!(contract.get(), 0); diff --git a/1/assets/1.4-finished-code.rs b/1/assets/1.4-finished-code.rs index 91ecd75..ffdbb4f 100644 --- a/1/assets/1.4-finished-code.rs +++ b/1/assets/1.4-finished-code.rs @@ -40,14 +40,15 @@ mod incrementer { #[cfg(test)] mod tests { use super::*; + use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { let contract = Incrementer::default(); assert_eq!(contract.get(), 0); } - #[test] + #[ink::test] fn it_works() { let mut contract = Incrementer::new(42); assert_eq!(contract.get(), 42); diff --git a/1/assets/1.4-template.rs b/1/assets/1.4-template.rs index 47f7fce..6294162 100644 --- a/1/assets/1.4-template.rs +++ b/1/assets/1.4-template.rs @@ -40,14 +40,15 @@ mod incrementer { #[cfg(test)] mod tests { use super::*; + use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { let contract = Incrementer::default(); assert_eq!(contract.get(), 0); } - #[test] + #[ink::test] fn it_works() { let mut contract = Incrementer::new(42); assert_eq!(contract.get(), 42); diff --git a/1/assets/1.5-finished-code.rs b/1/assets/1.5-finished-code.rs index 9320d80..ecc2528 100644 --- a/1/assets/1.5-finished-code.rs +++ b/1/assets/1.5-finished-code.rs @@ -55,13 +55,13 @@ mod incrementer { use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { let contract = Incrementer::default(); assert_eq!(contract.get(), 0); } - #[test] + #[ink::test] fn it_works() { let mut contract = Incrementer::new(42); assert_eq!(contract.get(), 42); diff --git a/1/assets/1.5-template.rs b/1/assets/1.5-template.rs index a338956..76ab65e 100644 --- a/1/assets/1.5-template.rs +++ b/1/assets/1.5-template.rs @@ -55,13 +55,13 @@ mod incrementer { // Alias `ink_lang` so we can use `ink::test`. use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { let contract = Incrementer::default(); assert_eq!(contract.get(), 0); } - #[test] + #[ink::test] fn it_works() { let mut contract = Incrementer::new(42); assert_eq!(contract.get(), 42); diff --git a/1/assets/1.6-finished-code.rs b/1/assets/1.6-finished-code.rs index 5af221e..c2728a7 100644 --- a/1/assets/1.6-finished-code.rs +++ b/1/assets/1.6-finished-code.rs @@ -61,13 +61,13 @@ mod incrementer { use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { let contract = Incrementer::default(); assert_eq!(contract.get(), 0); } - #[test] + #[ink::test] fn it_works() { let mut contract = Incrementer::new(42); assert_eq!(contract.get(), 42); diff --git a/1/assets/1.6-template.rs b/1/assets/1.6-template.rs index 97bf639..4f07205 100644 --- a/1/assets/1.6-template.rs +++ b/1/assets/1.6-template.rs @@ -61,13 +61,13 @@ mod incrementer { use ink_lang as ink; - #[test] + #[ink::test] fn default_works() { let contract = Incrementer::default(); assert_eq!(contract.get(), 0); } - #[test] + #[ink::test] fn it_works() { let mut contract = Incrementer::new(42); assert_eq!(contract.get(), 42);