Skip to content

Commit

Permalink
test: fix print example (#443)
Browse files Browse the repository at this point in the history
* fix

* add bats test
  • Loading branch information
lwshang authored Nov 7, 2023
1 parent 0b201e9 commit 56e9899
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
8 changes: 5 additions & 3 deletions examples/print/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[workspace]
members = [
"src/print_rs",
]
members = ["src/print_rs"]

[workspace.dependencies]
ic-cdk = { path = "../../src/ic-cdk" }
candid = "0.9"
3 changes: 2 additions & 1 deletion examples/print/src/print_rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ path = "lib.rs"
crate-type = ["cdylib"]

[dependencies]
ic-cdk = { path = "../../../../src/ic-cdk" }
ic-cdk.workspace = true
candid.workspace = true
2 changes: 1 addition & 1 deletion examples/print/src/print_rs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ fn print() {
ic_cdk::print("Hello World");
}

ic_cdk::export_candid!(::ic_cdk::export::candid);
ic_cdk::export_candid!();
17 changes: 17 additions & 0 deletions examples/print/tests/basic.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Executed before each test.
setup() {
cd examples/print
# Make sure the directory is clean.
dfx start --clean --background
}

# executed after each test
teardown() {
dfx stop
}

@test "Can print" {
dfx deploy

dfx canister call print print
}

0 comments on commit 56e9899

Please sign in to comment.