MCPcopy Create free account
hub / github.com/goadesign/goa / TestNormalizeFileForPackageMatch

Function TestNormalizeFileForPackageMatch

eval/error_internal_test.go:5–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestNormalizeFileForPackageMatch(t *testing.T) {
6 cases := map[string]struct {
7 in string
8 want string
9 }{
10 "no version": {
11 in: "/home/me/src/goa/eval/error.go",
12 want: "/home/me/src/goa/eval/error.go",
13 },
14 "module cache version": {
15 in: "/home/me/go/pkg/mod/goa.design/goa/v3@v3.23.2/dsl/result_type.go",
16 want: "/home/me/go/pkg/mod/goa.design/goa/v3/dsl/result_type.go",
17 },
18 "multiple @ segments": {
19 in: "/home/me/go/pkg/mod/example.com/foo@v1.2.3/bar@v0.1.0/baz.go",
20 want: "/home/me/go/pkg/mod/example.com/foo/bar/baz.go",
21 },
22 }
23
24 for name, tc := range cases {
25 t.Run(name, func(t *testing.T) {
26 got := normalizeFileForPackageMatch(tc.in)
27 if got != tc.want {
28 t.Errorf("got %q, want %q", got, tc.want)
29 }
30 })
31 }
32}

Callers

nothing calls this directly

Calls 2

RunMethod · 0.45

Tested by

no test coverage detected