Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
fd3e7e82
Unverified
Commit
fd3e7e82
authored
Dec 20, 2023
by
Wyatt Barnes
Committed by
GitHub
Dec 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Init BindGen unit tests (#8650)
parent
6914fb60
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
0 deletions
+89
-0
fixtures_bytecode_test.go
op-bindings/bindgen/fixtures_bytecode_test.go
+10
-0
fixtures_test.go
op-bindings/bindgen/fixtures_test.go
+50
-0
remote_handlers_test.go
op-bindings/bindgen/remote_handlers_test.go
+29
-0
No files found.
op-bindings/bindgen/fixtures_bytecode_test.go
0 → 100644
View file @
fd3e7e82
This source diff could not be displayed because it is too large. You can
view the blob
instead.
op-bindings/bindgen/fixtures_test.go
0 → 100644
View file @
fd3e7e82
package
main
// The Init bytecode used for these tests can either be sourced
// on-chain using the deployment tx of these contracts, or can be
// found in the bindings output from BindGen (../bindings/)
var
removeDeploymentSaltTests
=
[]
struct
{
name
string
deploymentData
string
deploymentSalt
string
expected
string
}{
{
"TestRemoveDeploymentSalt Case #1"
,
Safe_v130InitBytecode
,
"0000000000000000000000000000000000000000000000000000000000000000"
,
Safe_v130InitBytecodeNoSalt
,
},
{
"TestRemoveDeploymentSalt Case #2"
,
Permit2InitBytecode
,
"0000000000000000000000000000000000000000d3af2663da51c10215000000"
,
Permit2InitBytecodeNoSalt
,
},
{
"TestRemoveDeploymentSalt Case #3"
,
EntryPointInitBytecode
,
"0000000000000000000000000000000000000000000000000000000000000000"
,
EntryPointInitBytecodeNoSalt
,
},
}
var
removeDeploymentSaltTestsFailures
=
[]
struct
{
name
string
deploymentData
string
deploymentSalt
string
expectedError
string
}{
{
"TestRemoveDeploymentSalt Failure Case #1 Invalid Regex"
,
"0x1234abc"
,
"[invalid-regex"
,
"failed to compile regular expression: error parsing regexp: missing closing ]: `[invalid-regex)`"
,
},
{
"TestRemoveDeploymentSalt Failure Case #2 Salt Not Found"
,
"0x1234abc"
,
"4567"
,
"expected salt: 4567 to be at the beginning of the contract initialization code: 0x1234abc, but it wasn't"
,
},
}
op-bindings/bindgen/remote_handlers_test.go
0 → 100644
View file @
fd3e7e82
package
main
import
(
"testing"
"github.com/stretchr/testify/require"
)
func
TestRemoveDeploymentSalt
(
t
*
testing
.
T
)
{
generator
:=
bindGenGeneratorRemote
{}
for
_
,
tt
:=
range
removeDeploymentSaltTests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
got
,
_
:=
generator
.
removeDeploymentSalt
(
tt
.
deploymentData
,
tt
.
deploymentSalt
)
require
.
Equal
(
t
,
tt
.
expected
,
got
)
})
}
}
func
TestRemoveDeploymentSaltFailures
(
t
*
testing
.
T
)
{
generator
:=
bindGenGeneratorRemote
{}
for
_
,
tt
:=
range
removeDeploymentSaltTestsFailures
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
_
,
err
:=
generator
.
removeDeploymentSalt
(
tt
.
deploymentData
,
tt
.
deploymentSalt
)
require
.
Equal
(
t
,
err
.
Error
(),
tt
.
expectedError
)
})
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment