(ctx context.Context, t *testctx.T)
| 2243 | } |
| 2244 | |
| 2245 | func (CallSuite) TestGitMod(ctx context.Context, t *testctx.T) { |
| 2246 | testOnMultipleVCS(t, func(ctx context.Context, t *testctx.T, tc vcsTestCase) { |
| 2247 | t.Run("go", func(ctx context.Context, t *testctx.T) { |
| 2248 | c := connect(ctx, t) |
| 2249 | privateSetup, cleanup := privateRepoSetup(c, t, tc) |
| 2250 | defer cleanup() |
| 2251 | |
| 2252 | out, err := goGitBase(t, c). |
| 2253 | With(privateSetup). |
| 2254 | With(daggerCallAt(testGitModuleRef(tc, "top-level"), "fn")). |
| 2255 | Stdout(ctx) |
| 2256 | require.NoError(t, err) |
| 2257 | require.Equal(t, "hi from top level hi from dep hi from dep2", strings.TrimSpace(out)) |
| 2258 | }) |
| 2259 | |
| 2260 | t.Run("go dep", func(ctx context.Context, t *testctx.T) { |
| 2261 | c := connect(ctx, t) |
| 2262 | privateSetup, cleanup := privateRepoSetup(c, t, tc) |
| 2263 | defer cleanup() |
| 2264 | |
| 2265 | out, err := goGitBase(t, c). |
| 2266 | With(privateSetup). |
| 2267 | With(daggerExec("init", "--source=.", "--name=foo", "--sdk=go")). |
| 2268 | With(daggerExec("install", testGitModuleRef(tc, "top-level"))). |
| 2269 | WithNewFile("main.go", `package main |
| 2270 | import ( |
| 2271 | "context" |
| 2272 | ) |
| 2273 | |
| 2274 | type Foo struct {} |
| 2275 | |
| 2276 | func (m *Foo) Fn(ctx context.Context) (string, error) { |
| 2277 | return dag.TopLevel().Fn(ctx) |
| 2278 | } |
| 2279 | `). |
| 2280 | With(daggerCall("fn")). |
| 2281 | Stdout(ctx) |
| 2282 | require.NoError(t, err) |
| 2283 | require.Equal(t, "hi from top level hi from dep hi from dep2", strings.TrimSpace(out)) |
| 2284 | }) |
| 2285 | |
| 2286 | t.Run("typescript", func(ctx context.Context, t *testctx.T) { |
| 2287 | c := connect(ctx, t) |
| 2288 | privateSetup, cleanup := privateRepoSetup(c, t, tc) |
| 2289 | defer cleanup() |
| 2290 | |
| 2291 | out, err := goGitBase(t, c). |
| 2292 | With(privateSetup). |
| 2293 | With(daggerCallAt(testGitModuleRef(tc, "ts"), "container-echo", "--string-arg", "yoyo", "stdout")). |
| 2294 | Stdout(ctx) |
| 2295 | require.NoError(t, err) |
| 2296 | require.Equal(t, "yoyo", strings.TrimSpace(out)) |
| 2297 | }) |
| 2298 | |
| 2299 | t.Run("typescript dep", func(ctx context.Context, t *testctx.T) { |
| 2300 | c := connect(ctx, t) |
| 2301 | privateSetup, cleanup := privateRepoSetup(c, t, tc) |
| 2302 | defer cleanup() |
nothing calls this directly
no test coverage detected