Skip to content

Commit fcf7dff

Browse files
author
Maceo Thompson
committed
cmd/govulncheck: organize tests into subdirs
This change does not modify any tests, but organizes the preexisting tests into subdirectories. Change-Id: Id0634f646eae0aa9eceb98269acec2a76bbb2a6c Reviewed-on: https://go-review.googlesource.com/c/vuln/+/539662 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
1 parent 26305ce commit fcf7dff

25 files changed

+5
-4
lines changed

cmd/govulncheck/main_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ func TestCommand(t *testing.T) {
153153
varName := filepath.Base(md) + "_binary"
154154
os.Setenv(varName, binary)
155155
}
156-
runTestSuite(t, filepath.Join(testDir, "testdata"), govulndbURI.String(), *update)
156+
runTestSuite(t, filepath.Join(testDir, "testdata", "testfiles"), govulndbURI.String(), *update)
157157
if runtime.GOOS != "darwin" {
158158
// Binaries are not stripped on darwin with go1.21 and earlier. See #61051.
159-
runTestSuite(t, filepath.Join(testDir, "testdata/strip"), govulndbURI.String(), *update)
159+
runTestSuite(t, filepath.Join(testDir, "testdata", "strip"), govulndbURI.String(), *update)
160160
}
161161
}
162162

@@ -190,7 +190,7 @@ func runTestSuite(t *testing.T, dir string, govulndb string, update bool) {
190190
parallelLimiter = make(chan struct{}, limit)
191191
})
192192

193-
ts, err := cmdtest.Read(dir)
193+
ts, err := cmdtest.Read(filepath.Join(dir, "*"))
194194
if err != nil {
195195
t.Fatal(err)
196196
}

cmd/govulncheck/testdata/convert_text.ct renamed to cmd/govulncheck/testdata/testfiles/convert/convert_text.ct

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#####
22
# Test using the conversion from json on stdin to text on stdout
3-
$ govulncheck -mode=convert < convert_input.json --> FAIL 3
3+
# location of convert input is subdirectory/convert_intput
4+
$ govulncheck -mode=convert < convert/convert_input.json --> FAIL 3
45
Scanning your code and P packages across M dependent modules for known vulnerabilities...
56

67
Vulnerability #1: GO-2021-0265

0 commit comments

Comments
 (0)