TestWorkspaceBlueprint verifies that a blueprint module accepting a Workspace argument can access the host filesystem, just like a toolchain module.
(ctx context.Context, t *testctx.T)
| 75 | // TestWorkspaceBlueprint verifies that a blueprint module accepting a Workspace |
| 76 | // argument can access the host filesystem, just like a toolchain module. |
| 77 | func (WorkspaceSuite) TestBlueprint(ctx context.Context, t *testctx.T) { |
| 78 | c := connect(ctx, t) |
| 79 | |
| 80 | ctr := workspaceBase(t, c). |
| 81 | WithNewFile("hello.txt", "hello from workspace"). |
| 82 | With(initDangBlueprint("greeter", ` |
| 83 | type Greeter { |
| 84 | pub source: Directory! |
| 85 | |
| 86 | new(source: Workspace!) { |
| 87 | self.source = source.directory(".") |
| 88 | self |
| 89 | } |
| 90 | |
| 91 | pub read: String! { |
| 92 | source.file("hello.txt").contents |
| 93 | } |
| 94 | } |
| 95 | `)) |
| 96 | |
| 97 | out, err := ctr.With(daggerCall("read")).Stdout(ctx) |
| 98 | require.NoError(t, err) |
| 99 | require.Equal(t, "hello from workspace", strings.TrimSpace(out)) |
| 100 | } |
| 101 | |
| 102 | // TestWorkspaceFindUp verifies that Workspace.findUp searches up from the |
| 103 | // start path and stops at the workspace boundary. |
nothing calls this directly
no test coverage detected