(ctx context.Context, t *testctx.T)
| 1453 | } |
| 1454 | |
| 1455 | func (GoSuite) TestJSONField(ctx context.Context, t *testctx.T) { |
| 1456 | c := connect(ctx, t) |
| 1457 | |
| 1458 | modGen := c.Container().From(golangImage). |
| 1459 | WithMountedFile(testCLIBinPath, daggerCliFile(t, c)). |
| 1460 | WithWorkdir("/work"). |
| 1461 | With(daggerExec("init", "--source=.", "--name=minimal", "--sdk=go")). |
| 1462 | WithNewFile("main.go", `package main |
| 1463 | |
| 1464 | import ( |
| 1465 | "dagger/minimal/internal/dagger" |
| 1466 | ) |
| 1467 | |
| 1468 | type Minimal struct { |
| 1469 | Config dagger.JSON |
| 1470 | } |
| 1471 | |
| 1472 | func New() *Minimal { |
| 1473 | return &Minimal{ |
| 1474 | Config: "{\"a\":1}", |
| 1475 | } |
| 1476 | } |
| 1477 | `, |
| 1478 | ) |
| 1479 | |
| 1480 | out, err := modGen.With(daggerQuery(`{config}`)).Stdout(ctx) |
| 1481 | require.NoError(t, err) |
| 1482 | require.JSONEq(t, `{"config":"{\"a\":1}"}`, out) |
| 1483 | } |
| 1484 | |
| 1485 | // this is no longer allowed, but verify the Engine errors out |
| 1486 | func (GoSuite) TestExtendCore(ctx context.Context, t *testctx.T) { |
nothing calls this directly
no test coverage detected