forked from cerc-io/plugeth
signer: run tests in parallel (#28536)
marks tests as parallel-safe in package signer
This commit is contained in:
@@ -52,6 +52,7 @@ func verify(t *testing.T, jsondata, calldata string, exp []interface{}) {
|
||||
}
|
||||
|
||||
func TestNewUnpacker(t *testing.T) {
|
||||
t.Parallel()
|
||||
type unpackTest struct {
|
||||
jsondata string
|
||||
calldata string
|
||||
@@ -97,6 +98,7 @@ func TestNewUnpacker(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCalldataDecoding(t *testing.T) {
|
||||
t.Parallel()
|
||||
// send(uint256) : a52c101e
|
||||
// compareAndApprove(address,uint256,uint256) : 751e1079
|
||||
// issue(address[],uint256) : 42958b54
|
||||
@@ -159,6 +161,7 @@ func TestCalldataDecoding(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMaliciousABIStrings(t *testing.T) {
|
||||
t.Parallel()
|
||||
tests := []string{
|
||||
"func(uint256,uint256,[]uint256)",
|
||||
"func(uint256,uint256,uint256,)",
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package fourbyte
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts/abi"
|
||||
@@ -27,18 +27,19 @@ import (
|
||||
|
||||
// Tests that all the selectors contained in the 4byte database are valid.
|
||||
func TestEmbeddedDatabase(t *testing.T) {
|
||||
t.Parallel()
|
||||
db, err := New()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var abistruct abi.ABI
|
||||
for id, selector := range db.embedded {
|
||||
abistring, err := parseSelector(selector)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to convert selector to ABI: %v", err)
|
||||
continue
|
||||
}
|
||||
abistruct, err := abi.JSON(strings.NewReader(string(abistring)))
|
||||
if err != nil {
|
||||
if err := json.Unmarshal(abistring, &abistruct); err != nil {
|
||||
t.Errorf("Failed to parse ABI: %v", err)
|
||||
continue
|
||||
}
|
||||
@@ -55,6 +56,7 @@ func TestEmbeddedDatabase(t *testing.T) {
|
||||
|
||||
// Tests that custom 4byte datasets can be handled too.
|
||||
func TestCustomDatabase(t *testing.T) {
|
||||
t.Parallel()
|
||||
// Create a new custom 4byte database with no embedded component
|
||||
tmpdir := t.TempDir()
|
||||
filename := fmt.Sprintf("%s/4byte_custom.json", tmpdir)
|
||||
|
||||
@@ -73,6 +73,7 @@ type txtestcase struct {
|
||||
}
|
||||
|
||||
func TestTransactionValidation(t *testing.T) {
|
||||
t.Parallel()
|
||||
var (
|
||||
// use empty db, there are other tests for the abi-specific stuff
|
||||
db = newEmpty()
|
||||
|
||||
Reference in New Issue
Block a user