Skip to content

Commit

Permalink
internal/symbols: make patch tests work on windows
Browse files Browse the repository at this point in the history
Change-Id: I106039ac42bbc88768837f532b75d2664f554939
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/537675
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Tatiana Bradley <[email protected]>
Run-TryBot: Zvonimir Pavlinovic <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
zpavlinovic committed Oct 25, 2023
1 parent 2ff618d commit dd1db77
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/symbols/patched_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestModuleRootAndFiles(t *testing.T) {
if err != nil {
t.Error(err)
}
return rel
return filepath.ToSlash(rel)
}

fileNames := func(filePaths []string) []string {
Expand Down Expand Up @@ -98,14 +98,23 @@ func TestModuleRootAndFiles(t *testing.T) {
}

func TestModuleRoots(t *testing.T) {
toSlash := func(modRoots map[string]string) map[string]string {
m := make(map[string]string)
for mod, root := range modRoots {
m[mod] = filepath.ToSlash(root)
}
return m
}

want := map[string]string{
"golang.org/module": "testdata/module",
"golang.org/nestedmodule": "testdata/module/submodule",
}
got, err := moduleRoots("testdata/module")
roots, err := moduleRoots("testdata/module")
if err != nil {
t.Fatal(err)
}
got := toSlash(roots)
if diff := cmp.Diff(want, got); diff != "" {
t.Errorf("(-got, want+):\n%s", diff)
}
Expand Down

0 comments on commit dd1db77

Please sign in to comment.