MCPcopy Index your code
hub / github.com/dagger/dagger / TestGitModuleSourceSymbolic

Function TestGitModuleSourceSymbolic

core/modulesource_test.go:109–149  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func TestGitModuleSourceSymbolic(t *testing.T) {
110 testCases := []struct {
111 name string
112 cloneRef string
113 rootSubpath string
114 expected string
115 }{
116 {
117 name: "Go-style URL",
118 cloneRef: "https://github.com/user/repo.git",
119 rootSubpath: "subdir",
120 expected: "https://github.com/user/repo.git/subdir",
121 },
122 {
123 name: "SCP-like reference",
124 cloneRef: "git@github.com:user/repo.git",
125 rootSubpath: "subdir",
126 expected: "git@github.com:user/repo.git/subdir",
127 },
128 {
129 name: "SCP-like reference with no subdir",
130 cloneRef: "git@github.com:user/repo.git",
131 rootSubpath: "",
132 expected: "git@github.com:user/repo.git",
133 },
134 }
135
136 for _, tc := range testCases {
137 t.Run(tc.name, func(t *testing.T) {
138 src := &ModuleSource{
139 Kind: ModuleSourceKindGit,
140 Git: &GitModuleSource{
141 CloneRef: tc.cloneRef,
142 },
143 SourceRootSubpath: tc.rootSubpath,
144 }
145 result := src.AsString()
146 require.Equal(t, tc.expected, result, "AsString() returned unexpected result")
147 })
148 }
149}
150
151func moduleSourceTestSyntheticCall(op string, typ dagql.Typed) *dagql.ResultCall {
152 return &dagql.ResultCall{

Callers

nothing calls this directly

Calls 3

AsStringMethod · 0.95
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected