Skip to content

Commit 77962e9

Browse files
authored
dev: fix linter tests (#3128)
1 parent f48530e commit 77962e9

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

test/linters_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func testSourcesFromDir(t *testing.T, dir string) {
6161
t.Run(filepath.Base(source), func(subTest *testing.T) {
6262
subTest.Parallel()
6363

64-
rel, err := filepath.Rel(dir, sources[0])
64+
rel, err := filepath.Rel(dir, source)
6565
require.NoError(t, err)
6666

6767
testOneSource(subTest, log, binPath, rel)

test/testshared/runner.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,17 @@ func (b *RunnerBuilder) WithRunContext(rc *RunContext) *RunnerBuilder {
104104
return b
105105
}
106106

107-
return b.WithConfigFile(rc.ConfigPath).WithArgs(rc.Args...)
107+
dir, err := os.Getwd()
108+
require.NoError(b.tb, err)
109+
110+
configPath := filepath.FromSlash(rc.ConfigPath)
111+
112+
base := filepath.Base(dir)
113+
if strings.HasPrefix(configPath, base) {
114+
configPath = strings.TrimPrefix(configPath, base+string(filepath.Separator))
115+
}
116+
117+
return b.WithConfigFile(configPath).WithArgs(rc.Args...)
108118
}
109119

110120
func (b *RunnerBuilder) WithDirectives(sourcePath string) *RunnerBuilder {

0 commit comments

Comments
 (0)