Skip to content

Commit

Permalink
ink::test attributes in new template (use-ink#190)
Browse files Browse the repository at this point in the history
* ink::test attributes in new template

* add use ink

* Update templates/new/lib.rs

Co-authored-by: Michael Müller <mich@elmueller.net>

Co-authored-by: Michael Müller <mich@elmueller.net>
  • Loading branch information
trace-andreason and cmichi authored Mar 30, 2021
1 parent c6ef762 commit fa99483
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions templates/new/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ mod {{name}} {
/// Imports all the definitions from the outer scope so we can use them here.
use super::*;

/// Imports `ink_lang` so we can use `#[ink::test]`.
use ink_lang as ink;

/// We test if the default constructor does its job.
#[test]
#[ink::test]
fn default_works() {
let {{name}} = {{camel_name}}::default();
assert_eq!({{name}}.get(), false);
}

/// We test a simple use case of our contract.
#[test]
#[ink::test]
fn it_works() {
let mut {{name}} = {{camel_name}}::new(false);
assert_eq!({{name}}.get(), false);
Expand Down

0 comments on commit fa99483

Please sign in to comment.