-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: generate unit test code #15
Conversation
Why not update |
cargo generate cannot work on the final destination folder, we have to use a script to modify this file. |
I mean in the pull request, we can update |
I want to generate unit test per contract automatically fn test_{{crate_name}}() {
// deploy contract
let mut context = Context::default();
let contract_bin: Bytes = Loader::default().load_binary("{{project-name}}"); |
Ah I see what this means here, but to me that brings more questions:
|
I prefer put test in individual contract folder, however, capsule and script-templates put it in the global workspace, I think it's better to follow the previous convention.
I haven't looked the detail of these template tests, are they the same as regular contract tests? If they are, I can add them as your suggestion. |
They are the same contract template you can add to the workspace, with varying options. |
Personally, I don't think following existing conventions here is that important, we are already introducing new tool with different commands. |
I tried to change it this way, but I found that cargo generate can't read files from the current workspace directory unless we change it with sed, but that makes the shell script complicated, so I went with the easy way: put a |
I understand the cause here, and I'm fine with the solution, but at least can we move all those
This way at least we know the files in |
And one more thing: it possible to generate a single contract as a repo, instead of using a workspace, do you think it makes sense to add a default unit test for the single standalone contract here: https://github.com/cryptape/ckb-script-templates/tree/main/standalone-contract? |
Added a folder
Resolved Please help to review again, thanks. |
No description provided.