Skip to content

Commit

Permalink
all: apply loopvar fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastien Binet <[email protected]>
  • Loading branch information
sbinet committed Sep 21, 2023
1 parent 6d0dacb commit 724506b
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 39 deletions.
4 changes: 2 additions & 2 deletions fastjet/algorithm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ func TestInclusiveJetAlgorithms(t *testing.T) {
ptmin: 0,
},
} {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

test := test
particles, err := loadParticles(test.input)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -314,10 +314,10 @@ func TestExclusiveJetAlgorithms(t *testing.T) {
dcut: 2.0,
},
} {
test := test
t.Run(test.name, func(t *testing.T) {
t.Parallel()

test := test
particles, err := loadParticles(test.input)
if err != nil {
t.Fatal(err)
Expand Down
33 changes: 22 additions & 11 deletions groot/rtree/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,12 @@ func (ScannerData) want(i int64) (data ScannerData) {
}

func TestReaderStruct(t *testing.T) {
for _, fname := range []string{
files := []string{
"../testdata/x-flat-tree.root",
rtests.XrdRemote("testdata/x-flat-tree.root"),
} {
}
for i := range files {
fname := files[i]
t.Run(fname, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -319,10 +321,12 @@ func TestReaderStruct(t *testing.T) {
}

func TestReaderVars(t *testing.T) {
for _, fname := range []string{
files := []string{
"../testdata/x-flat-tree.root",
rtests.XrdRemote("testdata/x-flat-tree.root"),
} {
}
for i := range files {
fname := files[i]
t.Run(fname, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -368,10 +372,12 @@ func TestReaderVars(t *testing.T) {
}

func TestReaderVarsMultipleTimes(t *testing.T) {
for _, fname := range []string{
files := []string{
"../testdata/mc_105986.ZZ.root",
rtests.XrdRemote("testdata/mc_105986.ZZ.root"),
} {
}
for i := range files {
fname := files[i]
t.Run(fname, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -411,10 +417,12 @@ func TestReaderVarsMultipleTimes(t *testing.T) {
}

func TestReaderStructWithCounterLeaf(t *testing.T) {
for _, fname := range []string{
files := []string{
"../testdata/x-flat-tree.root",
rtests.XrdRemote("testdata/x-flat-tree.root"),
} {
}
for i := range files {
fname := files[i]
t.Run(fname, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -469,10 +477,12 @@ func TestReaderStructWithCounterLeaf(t *testing.T) {
}

func TestReaderVarsWithCounterLeaf(t *testing.T) {
for _, fname := range []string{
files := []string{
"../testdata/x-flat-tree.root",
rtests.XrdRemote("testdata/x-flat-tree.root"),
} {
}
for i := range files {
fname := files[i]
t.Run(fname, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -532,7 +542,8 @@ func TestScannerStructWithStdVectorBool(t *testing.T) {
t.Fatal(err)
}

for _, fname := range files {
for i := range files {
fname := files[i]
t.Run(fname, func(t *testing.T) {
t.Parallel()

Expand Down
9 changes: 6 additions & 3 deletions groot/rtree/tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,12 @@ func TestSimpleTreeOverHTTP(t *testing.T) {
}

func TestTreeWithBasketWithTKeyData(t *testing.T) {
for _, fname := range []string{
files := []string{
"../testdata/PhaseSpaceSimulation.root",
rtests.XrdRemote("testdata/PhaseSpaceSimulation.root"),
} {
}
for i := range files {
fname := files[i]
t.Run(fname, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -1571,7 +1573,8 @@ func TestUprootTrees(t *testing.T) {
t.Fatal(err)
}

for _, fname := range files {
for i := range files {
fname := files[i]
t.Run(fname, func(t *testing.T) {
t.Parallel()

Expand Down
3 changes: 2 additions & 1 deletion xrootd/filesystem_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ func TestFileSystem_Open_Mock(t *testing.T) {
{"WithStat", xrdfs.FileHandle{0, 0, 0, 0}, &xrdfs.FileCompression{}, &xrdfs.EntryStat{HasStatInfo: true, EntrySize: 10}},
}

for _, tc := range testCases {
for i := range testCases {
tc := testCases[i]
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

Expand Down
45 changes: 24 additions & 21 deletions xrootd/filesystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func testFileSystem_Dirlist(t *testing.T, addr string) {
}

func TestFileSystem_Dirlist(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -129,11 +130,12 @@ func TestFileSystem_Open(t *testing.T) {
{"WithStat", xrdfs.OpenOptionsOpenRead | xrdfs.OpenOptionsReturnStatus, xrdfs.FileHandle{0, 0, 0, 0}, &emptyCompression, entryStat},
}

for _, addr := range testClientAddrs {
for _, tc := range testCases {
for i := range testClientAddrs {
addr := testClientAddrs[i]
for i := range testCases {
tc := testCases[i]
t.Run(addr+"/"+tc.name, func(t *testing.T) {
t.Parallel()

testFileSystem_Open(t, addr, tc.options, tc.handle, tc.compression, tc.info)
})
}
Expand Down Expand Up @@ -189,10 +191,10 @@ func testFileSystem_RemoveFile(t *testing.T, addr string) {
}

func TestFileSystem_RemoveFile(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

testFileSystem_RemoveFile(t, addr)
})
}
Expand Down Expand Up @@ -268,10 +270,10 @@ func testFileSystem_Truncate(t *testing.T, addr string) {
}

func TestFileSystem_Truncate(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

testFileSystem_Truncate(t, addr)
})
}
Expand Down Expand Up @@ -299,10 +301,10 @@ func testFileSystem_Stat(t *testing.T, addr string) {
}

func TestFileSystem_Stat(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

testFileSystem_Stat(t, addr)
})
}
Expand Down Expand Up @@ -352,10 +354,10 @@ func testFileSystem_VirtualStat(t *testing.T, addr string) {
}

func TestFileSystem_VirtualStat(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

testFileSystem_VirtualStat(t, addr)
})
}
Expand Down Expand Up @@ -419,17 +421,18 @@ func testFileSystem_RemoveDir(t *testing.T, addr string) {
}

func TestFileSystem_RemoveDir(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

testFileSystem_RemoveDir(t, addr)
})
}
}

func TestFileSystem_RemoveAll(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -562,10 +565,10 @@ func testFileSystem_Rename(t *testing.T, addr string) {
}

func TestFileSystem_Rename(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

testFileSystem_Rename(t, addr)
})
}
Expand Down Expand Up @@ -643,10 +646,10 @@ func testFileSystem_Chmod(t *testing.T, addr string) {
}

func TestFileSystem_Chmod(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

testFileSystem_Chmod(t, addr)
})
}
Expand Down Expand Up @@ -674,10 +677,10 @@ func testFileSystem_Statx(t *testing.T, addr string) {
}

func TestFileSystem_Statx(t *testing.T) {
for _, addr := range testClientAddrs {
for i := range testClientAddrs {
addr := testClientAddrs[i]
t.Run(addr, func(t *testing.T) {
t.Parallel()

testFileSystem_Statx(t, addr)
})
}
Expand Down
2 changes: 1 addition & 1 deletion xrootd/session_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestSession_ConnectionAbort(t *testing.T) {
_, err := xrdproto.ReadRequest(conn)
if err != nil {
cancel()
t.Fatalf("could not read request: %v", err)
t.Errorf("could not read request: %v", err)
}
conn.Close()
}
Expand Down

0 comments on commit 724506b

Please sign in to comment.