dfinity / ic-repl

Apache License 2.0
70 stars 10 forks source link

Try-catch-finally #26

Closed jzxchiang1 closed 1 year ago

jzxchiang1 commented 2 years ago

I'd like the ability to try-catch-finally over my asserts so that at the very end I can stop and delete my test canister, regardless of whether all of the asserts passed or not.

Right now, if my tests failed, my test canister (which I created at the top of my ic-repl script) doesn't get cleaned up.

chenyan2002 commented 2 years ago

I'm experimenting to see how far we can go without any control flow :)

For your use case, we can refactor the script into three separate files: 1) creating canisters; 2) testing; 3) clean up. At the end of the first script, you can use export "env.sh" to export all variables you have defined. Script 2 and 3 will load "env.sh" at the start to resume the work from 1.