Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d26f49f

Browse filesBrowse files
committed
Go: Update unit tests for hasInvalidToolchainVersion to assume installed version is 1.21
1 parent 9a89426 commit d26f49f
Copy full SHA for d26f49f

File tree

1 file changed

+6
-4
lines changed
Filter options

1 file changed

+6
-4
lines changed

‎go/extractor/project/project_test.go

Copy file name to clipboardExpand all lines: go/extractor/project/project_test.go
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,20 @@ func parseModFile(t *testing.T, contents string) *modfile.File {
3939
return modFile
4040
}
4141

42-
func testHasInvalidToolchainVersion(t *testing.T, contents string) bool {
43-
return hasInvalidToolchainVersion(parseModFile(t, contents))
42+
func testHasInvalidToolchainVersion(t *testing.T, installedToolchainVersion util.SemVer, contents string) bool {
43+
return hasInvalidToolchainVersion(installedToolchainVersion, parseModFile(t, contents))
4444
}
4545

4646
func TestHasInvalidToolchainVersion(t *testing.T) {
47+
installedToolchainVersion := util.NewSemVer("1.21")
48+
4749
invalid := []string{
4850
"go 1.21\n",
4951
"go 1.22\n",
5052
}
5153

5254
for _, v := range invalid {
53-
if !testHasInvalidToolchainVersion(t, v) {
55+
if !testHasInvalidToolchainVersion(t, installedToolchainVersion, v) {
5456
t.Errorf("Expected testHasInvalidToolchainVersion(\"%s\") to be true, but got false", v)
5557
}
5658
}
@@ -62,7 +64,7 @@ func TestHasInvalidToolchainVersion(t *testing.T) {
6264
}
6365

6466
for _, v := range valid {
65-
if testHasInvalidToolchainVersion(t, v) {
67+
if testHasInvalidToolchainVersion(t, installedToolchainVersion, v) {
6668
t.Errorf("Expected testHasInvalidToolchainVersion(\"%s\") to be false, but got true", v)
6769
}
6870
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.