gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source.
https://gno.land/
Other
880 stars 364 forks source link

chore(amino): add some tests #2325

Open grepsuzette opened 3 months ago

grepsuzette commented 3 months ago

This adds some doc and tests to tm2/pkg/amino to address the following in amino_test.go:

// XXX Test registering duplicate names or concrete types not in a package.

To run tests

cd tm2/pkg/amino
go test -v --run=WithPanic\$

Tests have uncovered a potential bug however in TestDupNamesMustPanic. Opening an issue now to document this, with a possible fix.

    // The following does NOT panic, but it should.
    // assert.Panics(t, func() {
    //  myPkg.WithTypes(
    //      tests.EmptyStruct{}, "A",
    //      tests.PrimitivesStruct{}, "B",
    //      tests.ShortArraysStruct{}, "A", // Same name
    //  )
    // })
Contributors' checklist... - [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 - [ ] Added references to related issues and PRs - [x] 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).
codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 54.60%. Comparing base (5541e35) to head (4785435).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2325 +/- ## ========================================== - Coverage 54.60% 54.60% -0.01% ========================================== Files 579 579 Lines 77899 77899 ========================================== - Hits 42539 42536 -3 - Misses 32191 32192 +1 - Partials 3169 3171 +2 ``` | [Flag](https://app.codecov.io/gh/gnolang/gno/pull/2325/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang) | Coverage Δ | | |---|---|---| | [tm2](https://app.codecov.io/gh/gnolang/gno/pull/2325/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang) | `54.46% <ø> (+0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.