-
Notifications
You must be signed in to change notification settings - Fork 373
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
fix: copy value in cv.map
#1112
Conversation
Looks good. It would be beneficial if you could incorporate a unit test to prevent potential regressions in the future. Thank you. |
@moul This bug only occurs in actual environment. both of running test file(_test.gno) with So, I'm not sure about what you meant by |
@gfanton is developing a new txtar-based integration system (https://github.com/gnolang/gno/compare/master...gfanton:feat/gnoland-txtar-driver?expand=1) designed for crafting such tests. However, for straightforward tests like these, a simpler alternative might be more fitting. Regardless, your PR is solid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@r3v4s master now has txtar integration tests; you're welcome to update this PR and add reproducible tests for what you outlined in the OP :) |
d6c0876
to
121dcb6
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1112 +/- ##
==========================================
- Coverage 56.17% 56.16% -0.01%
==========================================
Files 439 439
Lines 66242 66244 +2
==========================================
- Hits 37209 37204 -5
- Misses 26143 26149 +6
- Partials 2890 2891 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Reason for blocking has been resolved; @moul had previously approved the PR.
<!-- please provide a detailed description of the changes made in this pull request. --> ```go package mapindex var mapus map[uint64]string = make(map[uint64]string) func init() { mapus[3] = "three" mapus[5] = "five" mapus[9] = "nine" } func FindMapWithKey(k uint64) string { return mapus[k] } ``` `println(mapus[5])` will return 'five' in test cases run by `gno test` which is expected HOWEVER, with deployed package ```bash $ gnokey maketx addpkg \ -remote 127.0.0.1:26657 \ -broadcast=true \ -chainid dev \ -gas-fee 1ugnot \ -gas-wanted 9000000 \ -memo "" \ -pkgdir ./ \ -pkgpath gno.land/r/demo/mapindex \ test1 ``` calling ```bash $ gnokey maketx call \ -remote 127.0.0.1:26657 \ -broadcast=true \ -chainid dev \ -gas-fee 1ugnot \ -gas-wanted 9000000 \ -memo "" \ -pkgpath gno.land/r/demo/mapindex \ -func FindMapWithKey \ -args "3" \ test1 ``` will return nothing for value, and 'string' for type ```bash $ gnokey maketx call \ -remote 127.0.0.1:26657 \ -broadcast=true \ -chainid dev \ -gas-fee 1ugnot \ -gas-wanted 9000000 \ -memo "" \ -pkgpath gno.land/r/demo/mapindex \ -func FindMapWithKey \ -args "3" \ test1 Enter password. ( string) OK! GAS WANTED: 9000000 GAS USED: 73301 ``` ## Related PR - [x] gnolang#932 @tbruyelle <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details>
println(mapus[5])
will return 'five' in test cases run bygno test
which is expectedHOWEVER, with deployed package
$ gnokey maketx addpkg \ -remote 127.0.0.1:26657 \ -broadcast=true \ -chainid dev \ -gas-fee 1ugnot \ -gas-wanted 9000000 \ -memo "" \ -pkgdir ./ \ -pkgpath gno.land/r/demo/mapindex \ test1
calling
will return nothing for value, and 'string' for type
Related PR
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description