Skip to content
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.

Commit

Permalink
Use #[ink::test] instead of #[test] (#112)
Browse files Browse the repository at this point in the history
* Use `#[ink::test]` instead of `#[test]`

* Import `ink_lang`
  • Loading branch information
cmichi authored Mar 31, 2021
1 parent 84aa9d7 commit 2ec3d9a
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 17 deletions.
5 changes: 4 additions & 1 deletion 1/assets/1.1-finished-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion 1/assets/1.2-finished-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion 1/assets/1.2-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
3 changes: 2 additions & 1 deletion 1/assets/1.3-finished-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion 1/assets/1.3-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions 1/assets/1.4-finished-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions 1/assets/1.4-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions 1/assets/1.5-finished-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions 1/assets/1.5-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions 1/assets/1.6-finished-code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions 1/assets/1.6-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2ec3d9a

Please sign in to comment.