mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
all: fix loop copyvars no longer needed
This commit is contained in:
parent
533dc37de6
commit
8b9b29afb6
33 changed files with 0 additions and 49 deletions
|
|
@ -1199,7 +1199,6 @@ func TestUnpackRevert(t *testing.T) {
|
||||||
{"4e487b7100000000000000000000000000000000000000000000000000000000000000ff", "unknown panic code: 0xff", nil},
|
{"4e487b7100000000000000000000000000000000000000000000000000000000000000ff", "unknown panic code: 0xff", nil},
|
||||||
}
|
}
|
||||||
for index, c := range cases {
|
for index, c := range cases {
|
||||||
index, c := index, c
|
|
||||||
t.Run(fmt.Sprintf("case %d", index), func(t *testing.T) {
|
t.Run(fmt.Sprintf("case %d", index), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
got, err := UnpackRevert(common.Hex2Bytes(c.input))
|
got, err := UnpackRevert(common.Hex2Bytes(c.input))
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,6 @@ func TestEventTupleUnpack(t *testing.T) {
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
err := unpackTestEventData(tc.dest, tc.data, tc.jsonLog, assert)
|
err := unpackTestEventData(tc.dest, tc.data, tc.jsonLog, assert)
|
||||||
if tc.error == "" {
|
if tc.error == "" {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import (
|
||||||
func TestPack(t *testing.T) {
|
func TestPack(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
for i, test := range packUnpackTests {
|
for i, test := range packUnpackTests {
|
||||||
i, test := i, test
|
|
||||||
t.Run(strconv.Itoa(i), func(t *testing.T) {
|
t.Run(strconv.Itoa(i), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
encb, err := hex.DecodeString(test.packed)
|
encb, err := hex.DecodeString(test.packed)
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,6 @@ var reflectTests = []reflectTest{
|
||||||
func TestReflectNameToStruct(t *testing.T) {
|
func TestReflectNameToStruct(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
for _, test := range reflectTests {
|
for _, test := range reflectTests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
m, err := mapArgNamesToStructFields(test.args, reflect.ValueOf(test.struc))
|
m, err := mapArgNamesToStructFields(test.args, reflect.ValueOf(test.struc))
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,6 @@ func TestMakeTopics(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
got, err := MakeTopics(tt.args.query...)
|
got, err := MakeTopics(tt.args.query...)
|
||||||
|
|
@ -373,7 +372,6 @@ func TestParseTopics(t *testing.T) {
|
||||||
tests := setupTopicsTests()
|
tests := setupTopicsTests()
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
createObj := tt.args.createObj()
|
createObj := tt.args.createObj()
|
||||||
|
|
@ -393,7 +391,6 @@ func TestParseTopicsIntoMap(t *testing.T) {
|
||||||
tests := setupTopicsTests()
|
tests := setupTopicsTests()
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
outMap := make(map[string]interface{})
|
outMap := make(map[string]interface{})
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,6 @@ func TestMethodMultiReturn(t *testing.T) {
|
||||||
"Can not unpack into a slice with wrong types",
|
"Can not unpack into a slice with wrong types",
|
||||||
}}
|
}}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
err := abi.UnpackIntoInterface(tc.dest, "multi", data)
|
err := abi.UnpackIntoInterface(tc.dest, "multi", data)
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@ func (c *Chain) AccountsInHashOrder() []state.DumpAccount {
|
||||||
list := make([]state.DumpAccount, len(c.state))
|
list := make([]state.DumpAccount, len(c.state))
|
||||||
i := 0
|
i := 0
|
||||||
for addr, acc := range c.state {
|
for addr, acc := range c.state {
|
||||||
addr := addr
|
|
||||||
list[i] = acc
|
list[i] = acc
|
||||||
list[i].Address = &addr
|
list[i].Address = &addr
|
||||||
if len(acc.AddressHash) != 32 {
|
if len(acc.AddressHash) != 32 {
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,6 @@ a key before startingHash (wrong order). The server should return the first avai
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, tc := range tests {
|
for i, tc := range tests {
|
||||||
tc := tc
|
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
t.Log("\n")
|
t.Log("\n")
|
||||||
}
|
}
|
||||||
|
|
@ -429,7 +428,6 @@ of the test account. The server should return slots [2,3] (i.e. the 'next availa
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, tc := range tests {
|
for i, tc := range tests {
|
||||||
tc := tc
|
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
t.Log("\n")
|
t.Log("\n")
|
||||||
}
|
}
|
||||||
|
|
@ -526,7 +524,6 @@ func (s *Suite) TestSnapGetByteCodes(t *utesting.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, tc := range tests {
|
for i, tc := range tests {
|
||||||
tc := tc
|
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
t.Log("\n")
|
t.Log("\n")
|
||||||
}
|
}
|
||||||
|
|
@ -723,7 +720,6 @@ The server should reject the request.`,
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, tc := range tests {
|
for i, tc := range tests {
|
||||||
tc := tc
|
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
t.Log("\n")
|
t.Log("\n")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,6 @@ func TestAccountImport(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
importAccountWithExpect(t, test.key, test.output)
|
importAccountWithExpect(t, test.key, test.output)
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,6 @@ func TestKeyID(t *testing.T) {
|
||||||
{"third key", args{id: extractKeyId(gethPubKeys[2])}, "FD9813B2D2098484"},
|
{"third key", args{id: extractKeyId(gethPubKeys[2])}, "FD9813B2D2098484"},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
if got := keyID(tt.args.id); got != tt.want {
|
if got := keyID(tt.args.id); got != tt.want {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ func Test_SplitTagsFlag(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
if got := SplitTagsFlag(tt.args); !reflect.DeepEqual(got, tt.want) {
|
if got := SplitTagsFlag(tt.args); !reflect.DeepEqual(got, tt.want) {
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ func TestGetPassPhraseWithList(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
if got := GetPassPhraseWithList(tt.args.text, tt.args.confirmation, tt.args.index, tt.args.passwords); got != tt.want {
|
if got := GetPassPhraseWithList(tt.args.text, tt.args.confirmation, tt.args.index, tt.args.passwords); got != tt.want {
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,6 @@ func (sf *subfetcher) schedule(keys [][]byte, read bool) error {
|
||||||
// Append the tasks to the current queue
|
// Append the tasks to the current queue
|
||||||
sf.lock.Lock()
|
sf.lock.Lock()
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
key := key // closure for the append below
|
|
||||||
sf.tasks = append(sf.tasks, &subfetcherTask{read: read, key: key})
|
sf.tasks = append(sf.tasks, &subfetcherTask{read: read, key: key})
|
||||||
}
|
}
|
||||||
sf.lock.Unlock()
|
sf.lock.Unlock()
|
||||||
|
|
|
||||||
|
|
@ -546,9 +546,7 @@ func TestYParityJSONUnmarshalling(t *testing.T) {
|
||||||
DynamicFeeTxType,
|
DynamicFeeTxType,
|
||||||
BlobTxType,
|
BlobTxType,
|
||||||
} {
|
} {
|
||||||
txType := txType
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(fmt.Sprintf("txType=%d: %s", txType, test.name), func(t *testing.T) {
|
t.Run(fmt.Sprintf("txType=%d: %s", txType, test.name), func(t *testing.T) {
|
||||||
// Copy the base json
|
// Copy the base json
|
||||||
testJson := maps.Clone(baseJson)
|
testJson := maps.Clone(baseJson)
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,6 @@ func (d *Downloader) spawnSync(fetchers []func() error) error {
|
||||||
errc := make(chan error, len(fetchers))
|
errc := make(chan error, len(fetchers))
|
||||||
d.cancelWg.Add(len(fetchers))
|
d.cancelWg.Add(len(fetchers))
|
||||||
for _, fn := range fetchers {
|
for _, fn := range fetchers {
|
||||||
fn := fn
|
|
||||||
go func() { defer d.cancelWg.Done(); errc <- fn() }()
|
go func() { defer d.cancelWg.Done(); errc <- fn() }()
|
||||||
}
|
}
|
||||||
// Wait for the first error, then terminate the others.
|
// Wait for the first error, then terminate the others.
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,6 @@ func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subsc
|
||||||
select {
|
select {
|
||||||
case logs := <-matchedLogs:
|
case logs := <-matchedLogs:
|
||||||
for _, log := range logs {
|
for _, log := range logs {
|
||||||
log := log
|
|
||||||
notifier.Notify(rpcSub.ID, &log)
|
notifier.Notify(rpcSub.ID, &log)
|
||||||
}
|
}
|
||||||
case <-rpcSub.Err(): // client send an unsubscribe request
|
case <-rpcSub.Err(): // client send an unsubscribe request
|
||||||
|
|
|
||||||
|
|
@ -390,8 +390,6 @@ func testTransactionPropagation(t *testing.T, protocol uint) {
|
||||||
}
|
}
|
||||||
// Interconnect all the sink handlers with the source handler
|
// Interconnect all the sink handlers with the source handler
|
||||||
for i, sink := range sinks {
|
for i, sink := range sinks {
|
||||||
sink := sink // Closure for goroutine below
|
|
||||||
|
|
||||||
sourcePipe, sinkPipe := p2p.MsgPipe()
|
sourcePipe, sinkPipe := p2p.MsgPipe()
|
||||||
defer sourcePipe.Close()
|
defer sourcePipe.Close()
|
||||||
defer sinkPipe.Close()
|
defer sinkPipe.Close()
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,6 @@ type TxPool interface {
|
||||||
func MakeProtocols(backend Backend, network uint64, dnsdisc enode.Iterator) []p2p.Protocol {
|
func MakeProtocols(backend Backend, network uint64, dnsdisc enode.Iterator) []p2p.Protocol {
|
||||||
protocols := make([]p2p.Protocol, 0, len(ProtocolVersions))
|
protocols := make([]p2p.Protocol, 0, len(ProtocolVersions))
|
||||||
for _, version := range ProtocolVersions {
|
for _, version := range ProtocolVersions {
|
||||||
version := version // Closure
|
|
||||||
|
|
||||||
protocols = append(protocols, p2p.Protocol{
|
protocols = append(protocols, p2p.Protocol{
|
||||||
Name: ProtocolName,
|
Name: ProtocolName,
|
||||||
Version: version,
|
Version: version,
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,6 @@ type Backend interface {
|
||||||
func MakeProtocols(backend Backend) []p2p.Protocol {
|
func MakeProtocols(backend Backend) []p2p.Protocol {
|
||||||
protocols := make([]p2p.Protocol, len(ProtocolVersions))
|
protocols := make([]p2p.Protocol, len(ProtocolVersions))
|
||||||
for i, version := range ProtocolVersions {
|
for i, version := range ProtocolVersions {
|
||||||
version := version // Closure
|
|
||||||
|
|
||||||
protocols[i] = p2p.Protocol{
|
protocols[i] = p2p.Protocol{
|
||||||
Name: ProtocolName,
|
Name: ProtocolName,
|
||||||
Version: version,
|
Version: version,
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,6 @@ func (task *accountTask) activeSubTasks() map[common.Hash][]*storageTask {
|
||||||
last = task.res.hashes[len(task.res.hashes)-1]
|
last = task.res.hashes[len(task.res.hashes)-1]
|
||||||
)
|
)
|
||||||
for hash, subTasks := range task.SubTasks {
|
for hash, subTasks := range task.SubTasks {
|
||||||
subTasks := subTasks // closure
|
|
||||||
if hash.Cmp(last) <= 0 {
|
if hash.Cmp(last) <= 0 {
|
||||||
tasks[hash] = subTasks
|
tasks[hash] = subTasks
|
||||||
}
|
}
|
||||||
|
|
@ -765,8 +764,6 @@ func (s *Syncer) loadSyncStatus() {
|
||||||
}
|
}
|
||||||
s.tasks = progress.Tasks
|
s.tasks = progress.Tasks
|
||||||
for _, task := range s.tasks {
|
for _, task := range s.tasks {
|
||||||
task := task // closure for task.genBatch in the stacktrie writer callback
|
|
||||||
|
|
||||||
// Restore the completed storages
|
// Restore the completed storages
|
||||||
task.stateCompleted = make(map[common.Hash]struct{})
|
task.stateCompleted = make(map[common.Hash]struct{})
|
||||||
for _, hash := range task.StorageCompleted {
|
for _, hash := range task.StorageCompleted {
|
||||||
|
|
@ -790,8 +787,6 @@ func (s *Syncer) loadSyncStatus() {
|
||||||
// Restore leftover storage tasks
|
// Restore leftover storage tasks
|
||||||
for accountHash, subtasks := range task.SubTasks {
|
for accountHash, subtasks := range task.SubTasks {
|
||||||
for _, subtask := range subtasks {
|
for _, subtask := range subtasks {
|
||||||
subtask := subtask // closure for subtask.genBatch in the stacktrie writer callback
|
|
||||||
|
|
||||||
subtask.genBatch = ethdb.HookedBatch{
|
subtask.genBatch = ethdb.HookedBatch{
|
||||||
Batch: s.db.NewBatch(),
|
Batch: s.db.NewBatch(),
|
||||||
OnPut: func(key []byte, value []byte) {
|
OnPut: func(key []byte, value []byte) {
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
|
||||||
if !strings.HasSuffix(file.Name(), ".json") {
|
if !strings.HasSuffix(file.Name(), ".json") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
file := file // capture range variable
|
|
||||||
t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) {
|
t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
@ -183,7 +182,6 @@ func BenchmarkTracers(b *testing.B) {
|
||||||
if !strings.HasSuffix(file.Name(), ".json") {
|
if !strings.HasSuffix(file.Name(), ".json") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
file := file // capture range variable
|
|
||||||
b.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(b *testing.B) {
|
b.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(b *testing.B) {
|
||||||
blob, err := os.ReadFile(filepath.Join("testdata", "call_tracer", file.Name()))
|
blob, err := os.ReadFile(filepath.Join("testdata", "call_tracer", file.Name()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,6 @@ func testFlatCallTracer(tracerName string, dirPath string, t *testing.T) {
|
||||||
if !strings.HasSuffix(file.Name(), ".json") {
|
if !strings.HasSuffix(file.Name(), ".json") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
file := file // capture range variable
|
|
||||||
t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) {
|
t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ func testPrestateDiffTracer(tracerName string, dirPath string, t *testing.T) {
|
||||||
if !strings.HasSuffix(file.Name(), ".json") {
|
if !strings.HasSuffix(file.Name(), ".json") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
file := file // capture range variable
|
|
||||||
t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) {
|
t.Run(camel(strings.TrimSuffix(file.Name(), ".json")), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,6 @@ func TestStartRPC(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -513,7 +513,6 @@ func TestNodeRPCPrefix(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
name := fmt.Sprintf("http=%s ws=%s", test.httpPrefix, test.wsPrefix)
|
name := fmt.Sprintf("http=%s ws=%s", test.httpPrefix, test.wsPrefix)
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
cfg := &Config{
|
cfg := &Config{
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,6 @@ func TestGzipHandler(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
srv := httptest.NewServer(newGzipHandler(test.handler))
|
srv := httptest.NewServer(newGzipHandler(test.handler))
|
||||||
defer srv.Close()
|
defer srv.Close()
|
||||||
|
|
|
||||||
|
|
@ -395,7 +395,6 @@ func TestTestVectorsV5(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
net := newHandshakeTest()
|
net := newHandshakeTest()
|
||||||
defer net.close()
|
defer net.close()
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,6 @@ outer:
|
||||||
func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error) {
|
func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error) {
|
||||||
p.wg.Add(len(p.running))
|
p.wg.Add(len(p.running))
|
||||||
for _, proto := range p.running {
|
for _, proto := range p.running {
|
||||||
proto := proto
|
|
||||||
proto.closed = p.closed
|
proto.closed = p.closed
|
||||||
proto.wstart = writeStart
|
proto.wstart = writeStart
|
||||||
proto.werr = writeErr
|
proto.werr = writeErr
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,6 @@ func TestStreamReadBytes(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
name := fmt.Sprintf("input_%s/size_%d", test.input, test.size)
|
name := fmt.Sprintf("input_%s/size_%d", test.input, test.size)
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
s := NewStream(bytes.NewReader(unhex(test.input)), 0)
|
s := NewStream(bytes.NewReader(unhex(test.input)), 0)
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ var tests = []string{"uints", "nil", "rawvalue", "optional", "bigint", "uint256"
|
||||||
|
|
||||||
func TestOutput(t *testing.T) {
|
func TestOutput(t *testing.T) {
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test, func(t *testing.T) {
|
t.Run(test, func(t *testing.T) {
|
||||||
inputFile := filepath.Join("testdata", test+".in.txt")
|
inputFile := filepath.Join("testdata", test+".in.txt")
|
||||||
outputFile := filepath.Join("testdata", test+".out.txt")
|
outputFile := filepath.Join("testdata", test+".out.txt")
|
||||||
|
|
|
||||||
|
|
@ -776,7 +776,6 @@ func TestClientHTTP(t *testing.T) {
|
||||||
wantResult = echoResult{"a", 1, new(echoArgs)}
|
wantResult = echoResult{"a", 1, new(echoArgs)}
|
||||||
)
|
)
|
||||||
for i := range results {
|
for i := range results {
|
||||||
i := i
|
|
||||||
go func() {
|
go func() {
|
||||||
errc <- client.Call(&results[i], "test_echo", wantResult.String, wantResult.Int, wantResult.Args)
|
errc <- client.Call(&results[i], "test_echo", wantResult.String, wantResult.Int, wantResult.Args)
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,6 @@ func TestBlockNumberOrHash_WithNumber_MarshalAndUnmarshal(t *testing.T) {
|
||||||
{"finalized", int64(FinalizedBlockNumber)},
|
{"finalized", int64(FinalizedBlockNumber)},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
bnh := BlockNumberOrHashWithNumber(BlockNumber(test.number))
|
bnh := BlockNumberOrHashWithNumber(BlockNumber(test.number))
|
||||||
marshalled, err := json.Marshal(bnh)
|
marshalled, err := json.Marshal(bnh)
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ func TestExecutionSpecState(t *testing.T) {
|
||||||
|
|
||||||
func execStateTest(t *testing.T, st *testMatcher, test *StateTest) {
|
func execStateTest(t *testing.T, st *testMatcher, test *StateTest) {
|
||||||
for _, subtest := range test.Subtests() {
|
for _, subtest := range test.Subtests() {
|
||||||
subtest := subtest
|
|
||||||
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
|
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
|
||||||
|
|
||||||
// If -short flag is used, we don't execute all four permutations, only
|
// If -short flag is used, we don't execute all four permutations, only
|
||||||
|
|
@ -244,14 +243,12 @@ func runBenchmarkFile(b *testing.B, path string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, t := range m {
|
for _, t := range m {
|
||||||
t := t
|
|
||||||
runBenchmark(b, &t)
|
runBenchmark(b, &t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runBenchmark(b *testing.B, t *StateTest) {
|
func runBenchmark(b *testing.B, t *StateTest) {
|
||||||
for _, subtest := range t.Subtests() {
|
for _, subtest := range t.Subtests() {
|
||||||
subtest := subtest
|
|
||||||
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
|
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
|
||||||
|
|
||||||
b.Run(key, func(b *testing.B) {
|
b.Run(key, func(b *testing.B) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue