Skip to content
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

Improve vms/ tests with require #1505

Merged
merged 125 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
a2771ba
ban `require.Equal` when testing for `0`
dhrubabasu May 12, 2023
88f6841
Merge branch 'dev' into ban-require-equal-zero
dhrubabasu May 12, 2023
b065a98
ban usage of `require.Zero` when testing for length `0`
dhrubabasu May 12, 2023
0ccf063
Merge branch 'ban-require-equal-zero' into ban-require-zero-len
dhrubabasu May 12, 2023
fd714b1
add failing test
dhrubabasu May 12, 2023
d4d925b
fix
dhrubabasu May 12, 2023
e961d37
nit
dhrubabasu May 12, 2023
7aab521
Merge branch 'ban-require-zero-len' into ban-require-equal-len
dhrubabasu May 12, 2023
cfd7ca0
push
dhrubabasu May 12, 2023
946588a
ban usage of `nil` in require functions
dhrubabasu May 12, 2023
5fcf0f0
nit
dhrubabasu May 12, 2023
10dff95
fix regex
dhrubabasu May 12, 2023
9fdc7c5
nit
dhrubabasu May 12, 2023
c343bc9
Merge branch 'dev' into ban-require-equal-zero
StephenButtolph May 12, 2023
3dbdab1
merged
dhrubabasu May 12, 2023
5530818
Merge branch 'ban-require-zero-len' into ban-require-equal-len
dhrubabasu May 12, 2023
6b2a170
Merge branch 'ban-require-equal-len' into ban-require-nil
dhrubabasu May 12, 2023
421b72d
add comment
dhrubabasu May 12, 2023
0c919fd
match uint(0)
dhrubabasu May 12, 2023
f8c4359
Update scripts/lint.sh
dhrubabasu May 12, 2023
df6b971
Merge branch 'ban-require-equal-zero' into ban-require-zero-len
dhrubabasu May 12, 2023
4a37e01
merged
dhrubabasu May 12, 2023
7e40d38
nit
dhrubabasu May 12, 2023
fb10a1a
pr review
dhrubabasu May 12, 2023
7aadaf4
revert
dhrubabasu May 12, 2023
af4382d
nit
dhrubabasu May 12, 2023
5301a7d
nits
dhrubabasu May 12, 2023
e249d2b
reduce diff
dhrubabasu May 12, 2023
be82305
reduce diff
dhrubabasu May 12, 2023
8aa012d
reduce diff
dhrubabasu May 12, 2023
24fb051
nit
dhrubabasu May 12, 2023
7de1858
Merge branch 'ban-require-equal-len' into ban-require-nil
dhrubabasu May 12, 2023
dfeb84b
more nil checks
dhrubabasu May 12, 2023
7901762
wording
dhrubabasu May 12, 2023
2f1ba2d
regex nit
dhrubabasu May 12, 2023
90b376e
Merge branch 'ban-require-equal-len' into ban-require-nil
dhrubabasu May 12, 2023
4680df5
add linter
dhrubabasu May 13, 2023
e967771
fix
dhrubabasu May 13, 2023
ff94591
fix regex
dhrubabasu May 13, 2023
0aa2d36
moar
dhrubabasu May 13, 2023
720bfb0
nit
dhrubabasu May 13, 2023
b71ff1c
include multi-line functions
dhrubabasu May 13, 2023
31e4a37
should be good now
dhrubabasu May 13, 2023
c7226cf
moar
dhrubabasu May 13, 2023
e48fbb5
nit
dhrubabasu May 13, 2023
9de4464
add linter
dhrubabasu May 13, 2023
a81f769
fix
dhrubabasu May 13, 2023
488d1a8
nit
dhrubabasu May 13, 2023
f17e674
fix
dhrubabasu May 13, 2023
c375007
Merge branch 'enforce-require-no-error-inline' into ban-require-equal…
dhrubabasu May 13, 2023
52f623e
Update scripts/lint.sh
dhrubabasu May 13, 2023
b30352c
nit
dhrubabasu May 13, 2023
a96a2d1
fix regex
dhrubabasu May 13, 2023
f07c5aa
Merge branch 'enforce-require-no-error-inline' into ban-require-equal…
dhrubabasu May 13, 2023
c7d6c75
Improve `snow/` tests with `require`
dhrubabasu May 13, 2023
411d3fb
Merge branch 'ban-require-equal-error' into testing-snow
dhrubabasu May 14, 2023
1331037
push
dhrubabasu May 14, 2023
1924de4
Merge branch 'testing-snow' into t-fatal-ban-x-package
dhrubabasu May 14, 2023
1308279
Improve `vm/` tests with `require`
dhrubabasu May 14, 2023
e436605
nits
dhrubabasu May 14, 2023
b8bd341
Merge branch 'ban-require-equal-error' into testing-snow
dhrubabasu May 14, 2023
b4aa566
nit
dhrubabasu May 14, 2023
f792b36
Merge branch 'ban-require-equal-error' into testing-snow
dhrubabasu May 14, 2023
1013be5
export errors
dhrubabasu May 14, 2023
67a7194
Merge branch 'testing-snow' into t-fatal-ban-x-package
dhrubabasu May 14, 2023
77d537c
Merge branch 't-fatal-ban-x-package' into testing-vms
dhrubabasu May 14, 2023
689082f
nit
dhrubabasu May 14, 2023
0f6a4ad
Merge branch 'ban-require-equal-error' into testing-snow
dhrubabasu May 14, 2023
2d6083e
Merge branch 'testing-snow' into t-fatal-ban-x-package
dhrubabasu May 14, 2023
d8654b1
Merge branch 't-fatal-ban-x-package' into testing-vms
dhrubabasu May 14, 2023
be063bb
nit
dhrubabasu May 15, 2023
463b2da
nit
dhrubabasu May 15, 2023
31fa556
merged
dhrubabasu May 15, 2023
5e3745a
Merge branch 'ban-require-zero-len' into ban-require-equal-len
StephenButtolph May 15, 2023
6709b1c
Update scripts/lint.sh
dhrubabasu May 16, 2023
5d2f1e2
Update scripts/lint.sh
dhrubabasu May 16, 2023
0457148
Merge branch 'dev' into ban-require-zero-len
dhrubabasu May 16, 2023
f4f0c15
nit
dhrubabasu May 16, 2023
8fb3d2a
increase negative diff woooooo
dhrubabasu May 16, 2023
62d168e
nit
dhrubabasu May 16, 2023
e7cf371
regex is easy they said
dhrubabasu May 16, 2023
b9d80b3
revert regex changes
dhrubabasu May 16, 2023
d1d0fdc
revert window change
dhrubabasu May 16, 2023
38e5742
nit
dhrubabasu May 16, 2023
a4bca48
Merge branch 'dev' into ban-require-zero-len
dhrubabasu May 16, 2023
f824d68
Merge branch 'ban-require-zero-len' into ban-require-equal-len
dhrubabasu May 16, 2023
adf3e39
Merge branch 'ban-require-equal-len' into ban-require-nil
dhrubabasu May 16, 2023
b58df9d
merged
dhrubabasu May 16, 2023
b93c523
reduce diff
dhrubabasu May 16, 2023
3402670
merged
dhrubabasu May 17, 2023
674f4d4
Merge branch 'enforce-require-no-error-inline' into ban-require-equal…
dhrubabasu May 17, 2023
6e6dbc2
Merge branch 'ban-require-equal-error' into testing-snow
dhrubabasu May 17, 2023
e34c59e
Merge branch 'testing-snow' into t-fatal-ban-x-package
dhrubabasu May 17, 2023
1bfa6a0
merged
dhrubabasu May 17, 2023
1c8d49c
cleanup
dhrubabasu May 17, 2023
7309ed9
Merge branch 't-fatal-ban-x-package' into testing-vms
dhrubabasu May 17, 2023
5a8b271
nits
dhrubabasu May 17, 2023
51b303b
Merge branch 'dev' into enforce-require-no-error-inline
dhrubabasu May 18, 2023
00c95dd
Merge branch 'enforce-require-no-error-inline' into ban-require-equal…
dhrubabasu May 18, 2023
2a0294b
merged
dhrubabasu May 18, 2023
806eddf
Merge branch 'testing-snow' into t-fatal-ban-x-package
dhrubabasu May 18, 2023
3630c07
merged
dhrubabasu May 18, 2023
3d0b39f
merged
dhrubabasu Jun 12, 2023
41e92b7
revert non-snow changes
dhrubabasu Jun 12, 2023
6c8381e
nit
dhrubabasu Jun 12, 2023
5b8f55d
nit
dhrubabasu Jun 12, 2023
399dcdf
nit
dhrubabasu Jun 12, 2023
a825a8b
nit
dhrubabasu Jun 12, 2023
11497ad
nits
dhrubabasu Jun 12, 2023
50c3320
Merge branch 'dev' into testing-snow
Jun 13, 2023
e120b39
moar Empty
dhrubabasu Jun 13, 2023
e286b32
Merge branch 'dev' into testing-snow
dhrubabasu Jun 14, 2023
516e29b
merged
dhrubabasu Jun 14, 2023
909d2a4
nits
dhrubabasu Jun 14, 2023
b406c84
fix merge errors
dhrubabasu Jun 14, 2023
dd09ecb
merged
dhrubabasu Jun 14, 2023
51a6001
nit
dhrubabasu Jun 14, 2023
13d31cf
nit
dhrubabasu Jun 14, 2023
0470bce
nit
dhrubabasu Jun 14, 2023
b951e0c
nit
dhrubabasu Jun 14, 2023
68b6c41
nits
dhrubabasu Jun 15, 2023
550440e
merged
dhrubabasu Jun 15, 2023
e91659a
pr review
dhrubabasu Jun 15, 2023
7319b4a
fix merge error
dhrubabasu Jun 15, 2023
471c366
🎀
dhrubabasu Jun 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ids/aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var (
errNoIDWithAlias = errors.New("there is no ID with alias")
ErrNoIDWithAlias = errors.New("there is no ID with alias")
errNoAliasForID = errors.New("there is no alias for ID")
errAliasAlreadyMapped = errors.New("alias already mapped to an ID")
)
Expand Down Expand Up @@ -68,7 +68,7 @@ func (a *aliaser) Lookup(alias string) (ID, error) {
if id, ok := a.dealias[alias]; ok {
return id, nil
}
return ID{}, fmt.Errorf("%w: %s", errNoIDWithAlias, alias)
return ID{}, fmt.Errorf("%w: %s", ErrNoIDWithAlias, alias)
}

func (a *aliaser) PrimaryAlias(id ID) (string, error) {
Expand Down
4 changes: 2 additions & 2 deletions utils/formatting/address/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const addressSep = "-"

var (
errNoSeparator = errors.New("no separator found in address")
ErrNoSeparator = errors.New("no separator found in address")
errBits5To8 = errors.New("unable to convert address from 5-bit to 8-bit formatting")
errBits8To5 = errors.New("unable to convert address from 8-bit to 5-bit formatting")
)
Expand All @@ -25,7 +25,7 @@ var (
func Parse(addrStr string) (string, string, []byte, error) {
addressParts := strings.SplitN(addrStr, addressSep, 2)
if len(addressParts) < 2 {
return "", "", nil, errNoSeparator
return "", "", nil, ErrNoSeparator
}
chainID := addressParts[0]
rawAddr := addressParts[1]
Expand Down
7 changes: 2 additions & 5 deletions vms/avm/blocks/builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,12 @@ func TestBuilderBuildBlock(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require := require.New(t)
StephenButtolph marked this conversation as resolved.
Show resolved Hide resolved
ctrl := gomock.NewController(t)
defer ctrl.Finish()

builder := tt.builderFunc(ctrl)
_, err := builder.BuildBlock(context.Background())
require.ErrorIs(err, tt.expectedErr)
require.ErrorIs(t, err, tt.expectedErr)
})
}
}
Expand All @@ -511,9 +510,7 @@ func TestBlockBuilderAddLocalTx(t *testing.T) {
tx := transactions[0]
txID := tx.ID()
require.NoError(mempool.Add(tx))

has := mempool.Has(txID)
require.True(has)
require.True(mempool.Has(txID))

ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down
12 changes: 7 additions & 5 deletions vms/avm/fx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package avm
import (
"errors"
"testing"

"github.com/stretchr/testify/require"
)

var (
Expand Down Expand Up @@ -48,7 +50,7 @@ func (fx *FxTest) Initialize(vm interface{}) error {
return nil
}
if fx.T != nil {
fx.T.Fatal(errCalledInitialize)
require.FailNow(fx.T, errCalledInitialize.Error())
}
return errCalledInitialize
}
Expand All @@ -61,7 +63,7 @@ func (fx *FxTest) Bootstrapping() error {
return nil
}
if fx.T != nil {
fx.T.Fatal(errCalledBootstrapping)
require.FailNow(fx.T, errCalledBootstrapping.Error())
}
return errCalledBootstrapping
}
Expand All @@ -74,7 +76,7 @@ func (fx *FxTest) Bootstrapped() error {
return nil
}
if fx.T != nil {
fx.T.Fatal(errCalledBootstrapped)
require.FailNow(fx.T, errCalledBootstrapped.Error())
}
return errCalledBootstrapped
}
Expand All @@ -87,7 +89,7 @@ func (fx *FxTest) VerifyTransfer(tx, in, cred, utxo interface{}) error {
return nil
}
if fx.T != nil {
fx.T.Fatal(errCalledVerifyTransfer)
require.FailNow(fx.T, errCalledVerifyTransfer.Error())
}
return errCalledVerifyTransfer
}
Expand All @@ -100,7 +102,7 @@ func (fx *FxTest) VerifyOperation(tx, op, cred interface{}, utxos []interface{})
return nil
}
if fx.T != nil {
fx.T.Fatal(errCalledVerifyOperation)
require.FailNow(fx.T, errCalledVerifyOperation.Error())
}
return errCalledVerifyOperation
}
Loading