diff --git a/examples/print/Cargo.toml b/examples/print/Cargo.toml index 74a0decf6..d0d16f486 100644 --- a/examples/print/Cargo.toml +++ b/examples/print/Cargo.toml @@ -1,4 +1,6 @@ [workspace] -members = [ - "src/print_rs", -] +members = ["src/print_rs"] + +[workspace.dependencies] +ic-cdk = { path = "../../src/ic-cdk" } +candid = "0.9" diff --git a/examples/print/src/print_rs/Cargo.toml b/examples/print/src/print_rs/Cargo.toml index 3dd3a6261..17fa426d5 100644 --- a/examples/print/src/print_rs/Cargo.toml +++ b/examples/print/src/print_rs/Cargo.toml @@ -10,4 +10,5 @@ path = "lib.rs" crate-type = ["cdylib"] [dependencies] -ic-cdk = { path = "../../../../src/ic-cdk" } +ic-cdk.workspace = true +candid.workspace = true diff --git a/examples/print/src/print_rs/lib.rs b/examples/print/src/print_rs/lib.rs index 5114f52dc..aa188ba2f 100644 --- a/examples/print/src/print_rs/lib.rs +++ b/examples/print/src/print_rs/lib.rs @@ -3,4 +3,4 @@ fn print() { ic_cdk::print("Hello World"); } -ic_cdk::export_candid!(::ic_cdk::export::candid); +ic_cdk::export_candid!(); diff --git a/examples/print/tests/basic.bats b/examples/print/tests/basic.bats new file mode 100644 index 000000000..db5028e4b --- /dev/null +++ b/examples/print/tests/basic.bats @@ -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 +}