(ctx context.Context, t *testctx.T)
| 410 | } |
| 411 | |
| 412 | func (ShellSuite) TestNoLoadModule(ctx context.Context, t *testctx.T) { |
| 413 | t.Run("sanity check", func(ctx context.Context, t *testctx.T) { |
| 414 | c := connect(ctx, t) |
| 415 | out, err := modInit(t, c, "go", ""). |
| 416 | With(daggerShell(".help")). |
| 417 | Stdout(ctx) |
| 418 | require.NoError(t, err) |
| 419 | require.Contains(t, out, "container-echo") |
| 420 | }) |
| 421 | |
| 422 | t.Run("forced no load", func(ctx context.Context, t *testctx.T) { |
| 423 | c := connect(ctx, t) |
| 424 | out, err := modInit(t, c, "go", ""). |
| 425 | With(daggerShellNoMod(".help")). |
| 426 | Stdout(ctx) |
| 427 | require.NoError(t, err) |
| 428 | require.NotContains(t, out, "container-echo") |
| 429 | }) |
| 430 | |
| 431 | t.Run("dynamically loaded", func(ctx context.Context, t *testctx.T) { |
| 432 | c := connect(ctx, t) |
| 433 | out, err := modInit(t, c, "go", ""). |
| 434 | With(daggerShellNoMod(".cd .; .help")). |
| 435 | Stdout(ctx) |
| 436 | require.NoError(t, err) |
| 437 | require.Contains(t, out, "container-echo") |
| 438 | }) |
| 439 | |
| 440 | t.Run("stateless load", func(ctx context.Context, t *testctx.T) { |
| 441 | c := connect(ctx, t) |
| 442 | out, err := modInit(t, c, "go", ""). |
| 443 | With(daggerShellNoMod(". | .help container-echo")). |
| 444 | Stdout(ctx) |
| 445 | require.NoError(t, err) |
| 446 | require.Contains(t, out, "echoes whatever string argument") |
| 447 | }) |
| 448 | |
| 449 | t.Run("stateless .help load", func(ctx context.Context, t *testctx.T) { |
| 450 | c := connect(ctx, t) |
| 451 | out, err := modInit(t, c, "go", ""). |
| 452 | With(daggerShellNoMod(".help .")). |
| 453 | Stdout(ctx) |
| 454 | require.NoError(t, err) |
| 455 | require.Contains(t, out, "MODULE") |
| 456 | require.Contains(t, out, "A generated module for Test functions") |
| 457 | }) |
| 458 | } |
| 459 | |
| 460 | func (ShellSuite) TestLoadAnotherModule(ctx context.Context, t *testctx.T) { |
| 461 | test := `package main |
nothing calls this directly
no test coverage detected